sh: prevent warnings when using iounmap [Linux 4.4.187]

This Linux kernel change "sh: prevent warnings when using iounmap" is included in the Linux 4.4.187 release. This change is authored by Sam Ravnborg <sam [at]> on Thu Jul 11 20:52:52 2019 -0700. The commit for this change in Linux stable tree is d7b2690 (patch) which is from upstream commit 733f002. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 733f002.

sh: prevent warnings when using iounmap

[ Upstream commit 733f0025f0fb43e382b84db0930ae502099b7e62 ]

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.

Signed-off-by: Sam Ravnborg <>
Reviewed-by: Geert Uytterhoeven <>
Cc: Yoshinori Sato <>
Cc: Rich Felker <>
Cc: Will Deacon <>
Cc: Mark Brown <>
Cc: Inki Dae <>
Cc: Krzysztof Kozlowski <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Sasha Levin <>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 arch/sh/include/asm/io.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 3280a6b..b2592c3 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -370,7 +370,11 @@ static inline void ioremap_fixed_init(void) { }

 #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

Leave a Reply

Your email address will not be published. Required fields are marked *