diff options
author | Olav Kongas <ok@ee.rmk.(none)> | 2005-04-29 17:08:34 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-04-29 17:08:34 -0400 |
commit | 05f9869bf20e11bcb9b64b9ebd6a9cf89d6b71ba (patch) | |
tree | 007c152142085c5124337eda056e9798be53e084 | |
parent | 2d2669b62984b8d76b05a6a045390a3250317d21 (diff) |
[PATCH] ARM: 2649/1: Fix 'sparse -Wbitwise' warnings from MMIO macros
Patch from Olav Kongas
On ARM, the outX() and writeX() families of macros take the
result of cpu_to_leYY(), which is of restricted type __leYY,
and feed it to __raw_writeX(), which expect an argument of
unrestricted type. This results in 'sparse -Wbitwise'
warnings about incorrect types in assignments. Analogous
type mismatch warnings are issued for inX() and readX()
counterparts. The below patch resolves these warnings by
adding forced typecasts.
Signed-off-by: Olav Kongas
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | include/asm-arm/io.h | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h index 69bc7a3e8160..658ffa384fda 100644 --- a/include/asm-arm/io.h +++ b/include/asm-arm/io.h | |||
@@ -99,12 +99,16 @@ extern void __readwrite_bug(const char *fn); | |||
99 | */ | 99 | */ |
100 | #ifdef __io | 100 | #ifdef __io |
101 | #define outb(v,p) __raw_writeb(v,__io(p)) | 101 | #define outb(v,p) __raw_writeb(v,__io(p)) |
102 | #define outw(v,p) __raw_writew(cpu_to_le16(v),__io(p)) | 102 | #define outw(v,p) __raw_writew((__force __u16) \ |
103 | #define outl(v,p) __raw_writel(cpu_to_le32(v),__io(p)) | 103 | cpu_to_le16(v),__io(p)) |
104 | #define outl(v,p) __raw_writel((__force __u32) \ | ||
105 | cpu_to_le32(v),__io(p)) | ||
104 | 106 | ||
105 | #define inb(p) ({ unsigned int __v = __raw_readb(__io(p)); __v; }) | 107 | #define inb(p) ({ __u8 __v = __raw_readb(__io(p)); __v; }) |
106 | #define inw(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; }) | 108 | #define inw(p) ({ __u16 __v = le16_to_cpu((__force __le16) \ |
107 | #define inl(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; }) | 109 | __raw_readw(__io(p))); __v; }) |
110 | #define inl(p) ({ __u32 __v = le32_to_cpu((__force __le32) \ | ||
111 | __raw_readl(__io(p))); __v; }) | ||
108 | 112 | ||
109 | #define outsb(p,d,l) __raw_writesb(__io(p),d,l) | 113 | #define outsb(p,d,l) __raw_writesb(__io(p),d,l) |
110 | #define outsw(p,d,l) __raw_writesw(__io(p),d,l) | 114 | #define outsw(p,d,l) __raw_writesw(__io(p),d,l) |
@@ -149,9 +153,11 @@ extern void _memset_io(void __iomem *, int, size_t); | |||
149 | * IO port primitives for more information. | 153 | * IO port primitives for more information. |
150 | */ | 154 | */ |
151 | #ifdef __mem_pci | 155 | #ifdef __mem_pci |
152 | #define readb(c) ({ unsigned int __v = __raw_readb(__mem_pci(c)); __v; }) | 156 | #define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; }) |
153 | #define readw(c) ({ unsigned int __v = le16_to_cpu(__raw_readw(__mem_pci(c))); __v; }) | 157 | #define readw(c) ({ __u16 __v = le16_to_cpu((__force __le16) \ |
154 | #define readl(c) ({ unsigned int __v = le32_to_cpu(__raw_readl(__mem_pci(c))); __v; }) | 158 | __raw_readw(__mem_pci(c))); __v; }) |
159 | #define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \ | ||
160 | __raw_readl(__mem_pci(c))); __v; }) | ||
155 | #define readb_relaxed(addr) readb(addr) | 161 | #define readb_relaxed(addr) readb(addr) |
156 | #define readw_relaxed(addr) readw(addr) | 162 | #define readw_relaxed(addr) readw(addr) |
157 | #define readl_relaxed(addr) readl(addr) | 163 | #define readl_relaxed(addr) readl(addr) |
@@ -161,8 +167,10 @@ extern void _memset_io(void __iomem *, int, size_t); | |||
161 | #define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l) | 167 | #define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l) |
162 | 168 | ||
163 | #define writeb(v,c) __raw_writeb(v,__mem_pci(c)) | 169 | #define writeb(v,c) __raw_writeb(v,__mem_pci(c)) |
164 | #define writew(v,c) __raw_writew(cpu_to_le16(v),__mem_pci(c)) | 170 | #define writew(v,c) __raw_writew((__force __u16) \ |
165 | #define writel(v,c) __raw_writel(cpu_to_le32(v),__mem_pci(c)) | 171 | cpu_to_le16(v),__mem_pci(c)) |
172 | #define writel(v,c) __raw_writel((__force __u32) \ | ||
173 | cpu_to_le32(v),__mem_pci(c)) | ||
166 | 174 | ||
167 | #define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l) | 175 | #define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l) |
168 | #define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l) | 176 | #define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l) |