* [PATCH] sh: Convert nommu io{re,un}map() to static inline functions
@ 2022-02-15 8:51 Geert Uytterhoeven
2022-02-15 12:03 ` Jonathan Cameron
2022-02-15 19:16 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2022-02-15 8:51 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker
Cc: Christoph Hellwig, Kuninori Morimoto, kernel test robot,
Jonathan Cameron, Arnd Bergmann, linux-sh, linux-kernel,
Geert Uytterhoeven
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>.
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
This is actually the third time this change was made, as Christoph
converted iounmap() to a macro before in commit 98c90e5ea34e98bd ("sh:
remove __iounmap"), reverting commit 733f0025f0fb43e3 ("sh: prevent
warnings when using iounmap").
Probably sh-nommu should include <asm-generic/io.h>, but that would
require a lot more changes.
---
arch/sh/include/asm/io.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index cf9a3ec32406f856..fba90e670ed41d48 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -271,8 +271,12 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
#endif /* CONFIG_HAVE_IOREMAP_PROT */
#else /* CONFIG_MMU */
-#define iounmap(addr) do { } while (0)
-#define ioremap(offset, size) ((void __iomem *)(unsigned long)(offset))
+static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
+{
+ return (void __iomem *)(unsigned long)offset;
+}
+
+static inline void iounmap(volatile void __iomem *addr) { }
#endif /* CONFIG_MMU */
#define ioremap_uc ioremap
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sh: Convert nommu io{re,un}map() to static inline functions
2022-02-15 8:51 [PATCH] sh: Convert nommu io{re,un}map() to static inline functions Geert Uytterhoeven
@ 2022-02-15 12:03 ` Jonathan Cameron
2022-02-15 19:16 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2022-02-15 12:03 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Yoshinori Sato, Rich Felker, Christoph Hellwig, Kuninori Morimoto,
kernel test robot, Arnd Bergmann, linux-sh, linux-kernel
On Tue, 15 Feb 2022 09:51:05 +0100
Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> 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>.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Looks good.
Thanks for the quick response.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
> This is actually the third time this change was made, as Christoph
> converted iounmap() to a macro before in commit 98c90e5ea34e98bd ("sh:
> remove __iounmap"), reverting commit 733f0025f0fb43e3 ("sh: prevent
> warnings when using iounmap").
>
> Probably sh-nommu should include <asm-generic/io.h>, but that would
> require a lot more changes.
> ---
> arch/sh/include/asm/io.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
> index cf9a3ec32406f856..fba90e670ed41d48 100644
> --- a/arch/sh/include/asm/io.h
> +++ b/arch/sh/include/asm/io.h
> @@ -271,8 +271,12 @@ static inline void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
> #endif /* CONFIG_HAVE_IOREMAP_PROT */
>
> #else /* CONFIG_MMU */
> -#define iounmap(addr) do { } while (0)
> -#define ioremap(offset, size) ((void __iomem *)(unsigned long)(offset))
> +static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
> +{
> + return (void __iomem *)(unsigned long)offset;
> +}
> +
> +static inline void iounmap(volatile void __iomem *addr) { }
> #endif /* CONFIG_MMU */
>
> #define ioremap_uc ioremap
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sh: Convert nommu io{re,un}map() to static inline functions
2022-02-15 8:51 [PATCH] sh: Convert nommu io{re,un}map() to static inline functions Geert Uytterhoeven
2022-02-15 12:03 ` Jonathan Cameron
@ 2022-02-15 19:16 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-02-15 19:16 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Yoshinori Sato, Rich Felker, Christoph Hellwig, Kuninori Morimoto,
kernel test robot, Jonathan Cameron, Arnd Bergmann, linux-sh,
linux-kernel
On Tue, Feb 15, 2022 at 09:51:05AM +0100, Geert Uytterhoeven wrote:
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Fixes: 13f1fc870dd74713 ("sh: move the ioremap implementation out of line")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
> This is actually the third time this change was made, as Christoph
> converted iounmap() to a macro before in commit 98c90e5ea34e98bd ("sh:
> remove __iounmap"), reverting commit 733f0025f0fb43e3 ("sh: prevent
> warnings when using iounmap").
>
> Probably sh-nommu should include <asm-generic/io.h>, but that would
> require a lot more changes.
I don't think it would be all that bad. But between the breakage and
the fact that sh is almost unmaintained let's get the quick fix in if
we can..
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-15 19:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 8:51 [PATCH] sh: Convert nommu io{re,un}map() to static inline functions Geert Uytterhoeven
2022-02-15 12:03 ` Jonathan Cameron
2022-02-15 19:16 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).