* [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions
2020-01-09 0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
@ 2020-01-09 0:28 ` Kuninori Morimoto
2020-01-09 0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
2020-01-09 0:30 ` [PATCH][repost] SH: Convert iounmap() macros to inline functions Kuninori Morimoto
2 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09 0:28 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Macro ins[bwl]/outs[bwl] are just calling BUG(), but that results in
unused variable warnings all over the place.
This patch convert macro to inline to avoid warning
We will get this kind of warning without this patch
${LINUX}/drivers/iio/adc/ad7606_par.c:21:23: \
warning: unused variable 'st' [-Wunused-variable]
struct ad7606_state *st = iio_priv(indio_dev);
^~
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
arch/sh/include/asm/io_noioport.h | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/arch/sh/include/asm/io_noioport.h b/arch/sh/include/asm/io_noioport.h
index 90d6109..f7938fe 100644
--- a/arch/sh/include/asm/io_noioport.h
+++ b/arch/sh/include/asm/io_noioport.h
@@ -53,12 +53,34 @@ static inline void ioport_unmap(void __iomem *addr)
#define outw_p(x, addr) outw((x), (addr))
#define outl_p(x, addr) outl((x), (addr))
-#define insb(a, b, c) BUG()
-#define insw(a, b, c) BUG()
-#define insl(a, b, c) BUG()
+static inline void insb(unsigned long port, void *dst, unsigned long count)
+{
+ BUG();
+}
+
+static inline void insw(unsigned long port, void *dst, unsigned long count)
+{
+ BUG();
+}
+
+static inline void insl(unsigned long port, void *dst, unsigned long count)
+{
+ BUG();
+}
-#define outsb(a, b, c) BUG()
-#define outsw(a, b, c) BUG()
-#define outsl(a, b, c) BUG()
+static inline void outsb(unsigned long port, const void *src, unsigned long count)
+{
+ BUG();
+}
+
+static inline void outsw(unsigned long port, const void *src, unsigned long count)
+{
+ BUG();
+}
+
+static inline void outsl(unsigned long port, const void *src, unsigned long count)
+{
+ BUG();
+}
#endif /* __ASM_SH_IO_NOIOPORT_H */
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][repost] sh: clkfwk: remove r8/r16/r32
2020-01-09 0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
2020-01-09 0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
@ 2020-01-09 0:28 ` Kuninori Morimoto
2020-01-09 8:18 ` Geert Uytterhoeven
2020-01-09 0:30 ` [PATCH][repost] SH: Convert iounmap() macros to inline functions Kuninori Morimoto
2 siblings, 1 reply; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09 0:28 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
SH will get below warning
${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
return ioread8(addr);
^~~~
In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
from ${LINUX}/include/linux/io.h:13,
from ${LINUX}/drivers/sh/clk/cpg.c:14:
${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
argument is of type 'const void *'
extern unsigned int ioread8(void __iomem *);
^~~~~~~~~~~~~~
We don't need "const" for r8/r16/r32.
And we don't need r8/r16/r32 themselvs.
This patch cleanup these.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
drivers/sh/clk/cpg.c | 23 ++++-------------------
1 file changed, 4 insertions(+), 19 deletions(-)
diff --git a/drivers/sh/clk/cpg.c b/drivers/sh/clk/cpg.c
index eeb028b9..a5cacfe 100644
--- a/drivers/sh/clk/cpg.c
+++ b/drivers/sh/clk/cpg.c
@@ -36,36 +36,21 @@ static void sh_clk_write(int value, struct clk *clk)
iowrite32(value, clk->mapped_reg);
}
-static unsigned int r8(const void __iomem *addr)
-{
- return ioread8(addr);
-}
-
-static unsigned int r16(const void __iomem *addr)
-{
- return ioread16(addr);
-}
-
-static unsigned int r32(const void __iomem *addr)
-{
- return ioread32(addr);
-}
-
static int sh_clk_mstp_enable(struct clk *clk)
{
sh_clk_write(sh_clk_read(clk) & ~(1 << clk->enable_bit), clk);
if (clk->status_reg) {
- unsigned int (*read)(const void __iomem *addr);
+ unsigned int (*read)(void __iomem *addr);
int i;
void __iomem *mapped_status = (phys_addr_t)clk->status_reg -
(phys_addr_t)clk->enable_reg + clk->mapped_reg;
if (clk->flags & CLK_ENABLE_REG_8BIT)
- read = r8;
+ read = ioread8;
else if (clk->flags & CLK_ENABLE_REG_16BIT)
- read = r16;
+ read = ioread16;
else
- read = r32;
+ read = ioread32;
for (i = 1000;
(read(mapped_status) & (1 << clk->enable_bit)) && i;
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH][repost] SH: Convert iounmap() macros to inline functions
2020-01-09 0:26 [PATCH][repost] SH: compile fixup patches Kuninori Morimoto
2020-01-09 0:28 ` [PATCH][repost] sh: Convert ins[bwl]/outs[bwl] macros to inline functions Kuninori Morimoto
2020-01-09 0:28 ` [PATCH][repost] sh: clkfwk: remove r8/r16/r32 Kuninori Morimoto
@ 2020-01-09 0:30 ` Kuninori Morimoto
2 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2020-01-09 0:30 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker, Andrew Morton; +Cc: Linux-SH, Linux-Renesas
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Macro iounmap() do nothing, but that results in
unused variable warnings all over the place.
This patch convert it to inline to avoid warning
We will get this warning without this patch
${LINUX}/drivers/thermal/broadcom/ns-thermal.c:78:21: \
warning: unused variable 'ns_thermal' [-Wunused-variable]
struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
^~~~~~~~~~
Fixes: 98c90e5ea34e9 ("sh: remove __iounmap")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
---
arch/sh/include/asm/io.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 1495489..351a0a9 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -328,7 +328,7 @@ __ioremap_mode(phys_addr_t offset, unsigned long size, pgprot_t prot)
#else
#define __ioremap(offset, size, prot) ((void __iomem *)(offset))
#define __ioremap_mode(offset, size, prot) ((void __iomem *)(offset))
-#define iounmap(addr) do { } while (0)
+static inline void iounmap(void __iomem *addr) {}
#endif /* CONFIG_MMU */
static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread