Skip to contentSkip to conversation

m32r: fix readl/writel prototypes

PATCH In review Arnd Bergmann 3 participants 3 messages Jan 2, 2018 Generic include/asm header files

lore
Share & tools
lore

Arnd Bergmann

author maintainer
#0 lore raw

PATCH 1/1 m32r: fix readl/writel prototypes

All other architectures use 'unsigned int' as the data in readl/write, but m32r uses 'unsigned long', leading to lots of harmless build warnings like:

drivers/mmc/host/dw_mmc.c: In function 'dw_mci_regs_show':
drivers/mmc/host/dw_mmc.c:168:31: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
seq_printf(s, "STATUS:\t0x%08x\n", mci_readl(host, STATUS));

---
 arch/m32r/include/asm/io.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/m32r/include/asm/io.h +4 -4
index 1b653bb16f9a..093486b5b931 100644
@@ -108,9 +108,9 @@ static inline unsigned short _readw(unsigned long addr)
 	return *(volatile unsigned short __force *)addr;
 }
 
-static inline unsigned long _readl(unsigned long addr)
+static inline unsigned int _readl(unsigned long addr)
 {
-	return *(volatile unsigned long __force *)addr;
+	return *(volatile unsigned int __force *)addr;
 }
 
 static inline void _writeb(unsigned char b, unsigned long addr)
@@ -123,9 +123,9 @@ static inline void _writew(unsigned short w, unsigned long addr)
 	*(volatile unsigned short __force *)addr = w;
 }
 
-static inline void _writel(unsigned long l, unsigned long addr)
+static inline void _writel(unsigned long l, unsigned int addr)
 {
-	*(volatile unsigned long __force *)addr = l;
+	*(volatile unsigned int __force *)addr = l;
 }
 
 #define inb     _inb
Signature · 1 line
2.9.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Arnd,

Quoted 7 lines · Arnd Bergmann

All other architectures use 'unsigned int' as the data in readl/write, but m32r uses 'unsigned long', leading to lots of harmless build warnings like:

drivers/mmc/host/dw_mmc.c: In function 'dw_mci_regs_show':
drivers/mmc/host/dw_mmc.c:168:31: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
seq_printf(s, "STATUS:\t0x%08x\n", mci_readl(host, STATUS));

Thanks for fixing this!

BTW, I started fixing this a while ago, too, but of course I dived too deep into arch/m32r/platforms/*/io.c (there are plenty of more type inconsistencies with asm-generic/io.h!), and gave up after ca. 500 lines of changes ;-)

Quoted 1 line

With the below fixed:

Quoted 15 lines
arch/m32r/include/asm/io.h +2 -2
@@ -108,9 +108,9 @@ static inline unsigned short _readw(unsigned long addr)
        return *(volatile unsigned short __force *)addr;
 }
 
-static inline unsigned long _readl(unsigned long addr)
+static inline unsigned int _readl(unsigned long addr)
 {
-       return *(volatile unsigned long __force *)addr;
+       return *(volatile unsigned int __force *)addr;
 }
 
 static inline void _writeb(unsigned char b, unsigned long addr)

arch/m32r/include/asm/io.h static inline void _writew(unsigned short w, unsigned long addr) · line 126

Quoted 5 lines
arch/m32r/include/asm/io.h +1 -1
@@ -123,9 +123,9 @@ static inline void _writew(unsigned short w, unsigned long addr)
        *(volatile unsigned short __force *)addr = w;
 }
 
-static inline void _writel(unsigned long l, unsigned long addr)
+static inline void _writel(unsigned long l, unsigned int addr)

Don't you want to change the type of "l" instead of the type of "addr"?

arch/m32r/include/asm/io.h static inline void _writew(unsigned short w, unsigned long addr) · line 129

Quoted 4 lines
arch/m32r/include/asm/io.h +1 -1
 {
-       *(volatile unsigned long __force *)addr = l;
+       *(volatile unsigned int __force *)addr = l;
 }

Gr{oetje,eeting}s,

Geert

--
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
In reply to Arnd Bergmann
Quoted 18 lines · Arnd Bergmann

All other architectures use 'unsigned int' as the data in readl/write, but m32r uses 'unsigned long', leading to lots of harmless build warnings like:

drivers/mmc/host/dw_mmc.c: In function 'dw_mci_regs_show':
drivers/mmc/host/dw_mmc.c:168:31: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
seq_printf(s, "STATUS:\t0x%08x\n", mci_readl(host, STATUS));

---
 arch/m32r/include/asm/io.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/m32r/include/asm/io.h +0 -0
index 1b653bb16f9a..093486b5b931 100644

arch/m32r/include/asm/io.h static inline unsigned short _readw(unsigned long addr) · line 114

Quoted 9 lines
arch/m32r/include/asm/io.h +2 -2
@@ -108,9 +108,9 @@ static inline unsigned short _readw(unsigned long addr)
 	return *(volatile unsigned short __force *)addr;
 }
 
-static inline unsigned long _readl(unsigned long addr)
+static inline unsigned int _readl(unsigned long addr)
 {
-	return *(volatile unsigned long __force *)addr;
+	return *(volatile unsigned int __force *)addr;
 }

The __force is not needed here, so I think it would be better to remove it. Maybe better to do that in another patch, though.

-- Luc Van Oostenryck