[PATCH 10/12] drm/v3d: Align data types of internal and uapi counts

Maíra Canal mcanal at igalia.com
Wed Jul 10 17:41:52 UTC 2024


On 7/10/24 10:41, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> 
> In the timestamp and performance extensions userspace type for counts is
> u32 so lets use unsigned in the kernel too.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> ---
>   drivers/gpu/drm/v3d/v3d_submit.c | 9 ++++++---
>   1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/v3d/v3d_submit.c b/drivers/gpu/drm/v3d/v3d_submit.c
> index 8dae3ab5f936..34ecd844f16a 100644
> --- a/drivers/gpu/drm/v3d/v3d_submit.c
> +++ b/drivers/gpu/drm/v3d/v3d_submit.c
> @@ -452,6 +452,7 @@ v3d_get_cpu_timestamp_query_params(struct drm_file *file_priv,
>   {
>   	u32 __user *offsets, *syncs;
>   	struct drm_v3d_timestamp_query timestamp;
> +	unsigned int i;
>   	int err;
>   
>   	if (!job) {
> @@ -481,7 +482,7 @@ v3d_get_cpu_timestamp_query_params(struct drm_file *file_priv,
>   	offsets = u64_to_user_ptr(timestamp.offsets);
>   	syncs = u64_to_user_ptr(timestamp.syncs);
>   
> -	for (int i = 0; i < timestamp.count; i++) {
> +	for (i = 0; i < timestamp.count; i++) {

Can't we just replace this line for
	for (u32 i = 0; i < timestamp.count; i++) {
or
	for (unsigned int i = 0; i < timestamp.count; i++) {
?

Well, anyway, just a minor nit, this is:

Reviewed-by: Maíra Canal <mcanal at igalia.com>

Best Regards,
- Maíra

>   		u32 offset, sync;
>   
>   		if (copy_from_user(&offset, offsets++, sizeof(offset))) {
> @@ -518,6 +519,7 @@ v3d_get_cpu_reset_timestamp_params(struct drm_file *file_priv,
>   {
>   	u32 __user *syncs;
>   	struct drm_v3d_reset_timestamp_query reset;
> +	unsigned int i;
>   	int err;
>   
>   	if (!job) {
> @@ -543,7 +545,7 @@ v3d_get_cpu_reset_timestamp_params(struct drm_file *file_priv,
>   
>   	syncs = u64_to_user_ptr(reset.syncs);
>   
> -	for (int i = 0; i < reset.count; i++) {
> +	for (i = 0; i < reset.count; i++) {
>   		u32 sync;
>   
>   		job->timestamp_query.queries[i].offset = reset.offset + 8 * i;
> @@ -576,7 +578,8 @@ v3d_get_cpu_copy_query_results_params(struct drm_file *file_priv,
>   {
>   	u32 __user *offsets, *syncs;
>   	struct drm_v3d_copy_timestamp_query copy;
> -	int i, err;
> +	unsigned int i;
> +	int err;
>   
>   	if (!job) {
>   		DRM_DEBUG("CPU job extension was attached to a GPU job.\n");


More information about the dri-devel mailing list