Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: s5p-mfc: fix sparse warnings

Commits a0f10c131cc49d7d84394beb7903e1f246331224 and
6c9fe765360efa97c63b89af685b620baf5e0012 ("media: s5p-mfc: fix broken
pointer cast on 64bit arch") fixed issue with lossy cast on 64-bit
architectures. However it also removed __iomem attribute from that cast.
This leads to sparse warnings. This patch fixes those warnings by adding
__iomem cast in case of v6+ code version and replacing readl/writel by
simple u32 load/store operations in case of v5 code (which is called on
system memory allocated by dma_alloc_coherent() instead of io registers).

Reported-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Marek Szyprowski and committed by
Mauro Carvalho Chehab
1d03deff e9763995

+4 -4
+2 -2
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c
··· 263 263 static void s5p_mfc_write_info_v5(struct s5p_mfc_ctx *ctx, unsigned int data, 264 264 unsigned int ofs) 265 265 { 266 - writel(data, (void *)(ctx->shm.virt + ofs)); 266 + *(u32 *)(ctx->shm.virt + ofs) = data; 267 267 wmb(); 268 268 } 269 269 ··· 271 271 unsigned long ofs) 272 272 { 273 273 rmb(); 274 - return readl((void *)(ctx->shm.virt + ofs)); 274 + return *(u32 *)(ctx->shm.virt + ofs); 275 275 } 276 276 277 277 static void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx)
+2 -2
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
··· 1852 1852 unsigned int ofs) 1853 1853 { 1854 1854 s5p_mfc_clock_on(); 1855 - writel(data, (void *)((unsigned long)ofs)); 1855 + writel(data, (void __iomem *)((unsigned long)ofs)); 1856 1856 s5p_mfc_clock_off(); 1857 1857 } 1858 1858 ··· 1862 1862 int ret; 1863 1863 1864 1864 s5p_mfc_clock_on(); 1865 - ret = readl((void *)ofs); 1865 + ret = readl((void __iomem *)ofs); 1866 1866 s5p_mfc_clock_off(); 1867 1867 1868 1868 return ret;