Skip to contentSkip to conversation

sh: clkfwk: don't pass void pointers to ioread*

PATCH In review Christoph Hellwig 2 participants 3 messages Jun 28, 2019 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: clkfwk: don't pass void pointers to ioread*

Passing pointers with a const attrÑ–bute to the ioread* functions causes a lot of compiler warnings, so remove the extra attributes.

---
 drivers/sh/clk/cpg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/sh/clk/cpg.c +4 -4
index eeb028b9cdb3..4f3d99d37809 100644
@@ -36,17 +36,17 @@ static void sh_clk_write(int value, struct clk *clk)
 		iowrite32(value, clk->mapped_reg);
 }
 
-static unsigned int r8(const void __iomem *addr)
+static unsigned int r8(void __iomem *addr)
 {
 	return ioread8(addr);
 }
 
-static unsigned int r16(const void __iomem *addr)
+static unsigned int r16(void __iomem *addr)
 {
 	return ioread16(addr);
 }
 
-static unsigned int r32(const void __iomem *addr)
+static unsigned int r32(void __iomem *addr)
 {
 	return ioread32(addr);
 }
@@ -55,7 +55,7 @@ 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;
Signature · 1 line
2.20.1
#1 lore raw

Hi Christoph,

Quoted 4 lines · Christoph Hellwig

Passing pointers with a const attrÑ–bute to the ioread* functions causes a lot of compiler warnings, so remove the extra attributes.

Thanks for your patch!

Quoted 9 lines
---
 drivers/sh/clk/cpg.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/sh/clk/cpg.c +0 -0
index eeb028b9cdb3..4f3d99d37809 100644

drivers/sh/clk/cpg.c static void sh_clk_write(int value, struct clk *clk) · line 39

Quoted 5 lines
drivers/sh/clk/cpg.c +1 -1
@@ -36,17 +36,17 @@ static void sh_clk_write(int value, struct clk *clk)
                iowrite32(value, clk->mapped_reg);
 }
 
-static unsigned int r8(const void __iomem *addr)
+static unsigned int r8(void __iomem *addr)

This is due to include/asm-generic/io.h and include/asm-generic/iomap.h using different prototypes, right?

include/asm-generic/io.h:static inline u8 ioread8(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u16 ioread16(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u32 ioread32(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u64 ioread64(const volatile void __iomem *addr)

include/asm-generic/iomap.h:extern unsigned int ioread8(void __iomem *); include/asm-generic/iomap.h:extern unsigned int ioread16(void __iomem *); include/asm-generic/iomap.h:extern unsigned int ioread32(void __iomem *); include/asm-generic/iomap.h:extern u64 ioread64(void __iomem *);

Wouldn't it be better to fix include/asm-generic/iomap.h and lib/iomap.c instead?

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
#2 lore raw
Quoted 12 lines · Geert Uytterhoeven

This is due to include/asm-generic/io.h and include/asm-generic/iomap.h using different prototypes, right?

include/asm-generic/io.h:static inline u8 ioread8(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u16 ioread16(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u32 ioread32(const volatile void __iomem *addr)
include/asm-generic/io.h:static inline u64 ioread64(const volatile void __iomem *addr)

Quoted 7 lines

include/asm-generic/iomap.h:extern unsigned int ioread8(void __iomem *); include/asm-generic/iomap.h:extern unsigned int ioread16(void __iomem *); include/asm-generic/iomap.h:extern unsigned int ioread32(void __iomem *); include/asm-generic/iomap.h:extern u64 ioread64(void __iomem *);

Wouldn't it be better to fix include/asm-generic/iomap.h and lib/iomap.c instead?

Oh, I didn't even notice we had this declared by different files..