Skip to contentSkip to conversation

sh: prevent warnings when using iounmap

PATCH In review Sam Ravnborg 2 participants 2 messages Jun 22, 2019 – Jun 24, 2019 SuperH

lore
Share & tools
lore
#0 lore raw

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.

Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc Will Deacon <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Mark Brown <[email protected]>
Cc Inki Dae <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
---
 arch/sh/include/asm/io.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/sh/include/asm/io.h +5 -1
index c28e37a344ad..ac0561960c52 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw

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_MMU is not defined
so it ended up in:

Quoted 8 lines

\#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.

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