[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3742bddc-51b5-71c9-4d4a-ec15d17a515a@suse.de>
Date: Mon, 10 Jul 2023 12:36:20 +0200
From: Thomas Zimmermann <tzimmermann@...e.de>
To: Sui Jingfeng <suijingfeng@...ngson.cn>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Li Yi <liyi@...ngson.cn>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
loongson-kernel@...ts.loongnix.cn,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] drm/loongson: Fix two warnings because of passing wrong
type
Hi
Am 10.07.23 um 12:09 schrieb Sui Jingfeng:
> When accessing I/O memory, we should pass '__iomem *' type instead of
> 'void *' simply, otherwise sparse tests will complain. After applied
> this patch, the following two sparse warnings got fixed.
>
> 1) drivers/gpu/drm/loongson/lsdc_benchmark.c:27:35:
> sparse: expected void volatile [noderef] __iomem *
> sparse: got void *kptr
>
> 2) drivers/gpu/drm/loongson/lsdc_benchmark.c:42:51:
> sparse: expected void const volatile [noderef] __iomem *
> sparse: got void *kptr
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307100243.v3hv6aes-lkp@intel.com/
> Signed-off-by: Sui Jingfeng <suijingfeng@...ngson.cn>
> ---
> drivers/gpu/drm/loongson/lsdc_benchmark.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_benchmark.c b/drivers/gpu/drm/loongson/lsdc_benchmark.c
> index b088646a2ff9..36e352820bdb 100644
> --- a/drivers/gpu/drm/loongson/lsdc_benchmark.c
> +++ b/drivers/gpu/drm/loongson/lsdc_benchmark.c
> @@ -24,7 +24,7 @@ static void lsdc_copy_gtt_to_vram_cpu(struct lsdc_bo *src_bo,
> lsdc_bo_kmap(dst_bo);
>
> while (n--)
> - memcpy_toio(dst_bo->kptr, src_bo->kptr, size);
> + memcpy_toio((void __iomem *)dst_bo->kptr, src_bo->kptr, size);
If this is I/O memory, better add the __iomem qualifier to dst_bo->kptr
rather than casting here. If if can be both, you could use an unnamed
union like this:
struct lscd_bo {
union {
void __iomem *kptr_iomem;
void *kptr;
};
};
Best regards
Thomas
>
> lsdc_bo_kunmap(src_bo);
> lsdc_bo_kunmap(dst_bo);
> @@ -39,7 +39,7 @@ static void lsdc_copy_vram_to_gtt_cpu(struct lsdc_bo *src_bo,
> lsdc_bo_kmap(dst_bo);
>
> while (n--)
> - memcpy_fromio(dst_bo->kptr, src_bo->kptr, size);
> + memcpy_fromio(dst_bo->kptr, (void __iomem *)src_bo->kptr, size);
>
> lsdc_bo_kunmap(src_bo);
> lsdc_bo_kunmap(dst_bo);
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)
Powered by blists - more mailing lists