sh: prevent warnings when using iounmap
PATCH 1/1 sh: prevent warnings when using iounmap
When building drm/exynos for sh, as part of an allmodconfig build, the following warning triggered:
exynos7_drm_decon.c: In function ‘decon_remove’:
exynos7_drm_decon.c:769:24: warning: unused variable ‘ctx’
struct decon_context *ctx = dev_get_drvdata(&pdev->dev);
The ctx variable is only used as argument to iounmap().
In sh - allmodconfig CONFIG_MMU is not defined so it ended up in:
\#define __iounmap(addr) do { } while (0)
\#define iounmap __iounmap
Fix the warning by introducing a static inline function for iounmap.
This is similar to several other architectures.
--- arch/sh/include/asm/io.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/sh/include/asm/io.h +5 -1
@@ -369,7 +369,11 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }#define ioremap_nocache ioremap#define ioremap_uc ioremap -#define iounmap __iounmap + +static inline void iounmap (void __iomem *addr) +{ +__iounmap (addr); +}/* * Convert a physical pointer to a virtual kernel pointer for /dev/mem
Signature · 1 line
2.20.1
Hi Sam,
Quoted 12 lines · Sam Ravnborg
When building drm/exynos for sh, as part of an allmodconfig build, the following warning triggered:
exynos7_drm_decon.c: In function ‘decon_remove’:
exynos7_drm_decon.c:769:24: warning: unused variable ‘ctx’struct decon_context *ctx = dev_get_drvdata(&pdev->dev);The ctx variable is only used as argument to
iounmap().In sh - allmodconfig
CONFIG_MMUis not defined
so it ended up in:
Quoted 8 lines
\#define
__iounmap(addr)do { } while (0)
\#define iounmap__iounmapFix the warning by introducing a static inline
function for iounmap.
This is similar to several other architectures.Signed-off-by Sam Ravnborg <[email protected]>
Thanks for your patch!
arch/sh/include/asm/io.h static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; } · line 376
Quoted 12 lines
arch/sh/include/asm/io.h +5
-1@@ -369,7 +369,11 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }#define ioremap_nocache ioremap#define ioremap_uc ioremap -#define iounmap __iounmap + +static inline void iounmap (void __iomem *addr) +{ +__iounmap (addr); +}
The alternative would be to make __iounmap() static inline, which may be better from the viewpoint of consistency within this header file.
Regardless:
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds