SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH] sh: prevent warnings when using iounmap
@ 2019-06-22 11:42 Sam Ravnborg
  2019-06-24  7:59 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Ravnborg @ 2019-06-22 11:42 UTC (permalink / raw)
  To: linux-kernel, linux-sh
  Cc: Yoshinori Sato, Rich Felker, Will Deacon, Andrew Morton,
	Mark Brown, Inki Dae, Krzysztof Kozlowski, 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:

\#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 <sam@ravnborg.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Inki Dae <inki.dae@samsung.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-sh@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 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 c28e37a344ad..ac0561960c52 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -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
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sh: prevent warnings when using iounmap
  2019-06-22 11:42 [PATCH] sh: prevent warnings when using iounmap Sam Ravnborg
@ 2019-06-24  7:59 ` Geert Uytterhoeven
  0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2019-06-24  7:59 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Linux Kernel Mailing List, Linux-sh list, Yoshinori Sato,
	Rich Felker, Will Deacon, Andrew Morton, Mark Brown, Inki Dae,
	Krzysztof Kozlowski

Hi Sam,

On Sat, Jun 22, 2019 at 1:45 PM Sam Ravnborg <sam@ravnborg.org> wrote:
> 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 <sam@ravnborg.org>

Thanks for your patch!

> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -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:
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-24  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-22 11:42 [PATCH] sh: prevent warnings when using iounmap Sam Ravnborg
2019-06-24  7:59 ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox