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

sh: convert nommu io{re,un}map() to static inline functions

Recently, nommu iounmap() was converted from a static inline function to a
macro again, basically reverting commit 4580ba4ad2e6b8dd ("sh: Convert
iounmap() macros to inline functions"). With -Werror, this leads to build
failures like:

drivers/iio/adc/xilinx-ams.c: In function `ams_iounmap_ps':
drivers/iio/adc/xilinx-ams.c:1195:14: error: unused variable `ams' [-Werror=unused-variable]
1195 | struct ams *ams = data;
| ^~~

Fix this by replacing the macros for ioremap() and iounmap() by static
inline functions, based on <asm-generic/io.h>.

Link: https://lkml.kernel.org/r/8d1b1766260961799b04035e7bc39a7f59729f72.1655708312.git.geert+renesas@glider.be
Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Geert Uytterhoeven and committed by
akpm
d684e0a5 73f37dbc

+6 -2
+6 -2
arch/sh/include/asm/io.h
··· 271 271 #endif /* CONFIG_HAVE_IOREMAP_PROT */ 272 272 273 273 #else /* CONFIG_MMU */ 274 - #define iounmap(addr) do { } while (0) 275 - #define ioremap(offset, size) ((void __iomem *)(unsigned long)(offset)) 274 + static inline void __iomem *ioremap(phys_addr_t offset, size_t size) 275 + { 276 + return (void __iomem *)(unsigned long)offset; 277 + } 278 + 279 + static inline void iounmap(volatile void __iomem *addr) { } 276 280 #endif /* CONFIG_MMU */ 277 281 278 282 #define ioremap_uc ioremap