[PATCH v1] alpha: io: Make sparse happy about bitwise types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Alpha the IO accessors are using plain unsigned types, such as uXX.
But Alpha can be configured to any endianess and implementation of
BE IO accessors, such as iowrite32be(), require endianess conversion.
This conversion, when done via cpu_to*() and *_to_cpu() helpers, uses
bitwise types of which sparse is not happy.

8250_dwlib.c:45:17: sparse: sparse: incorrect type in argument 1 (different base types)
8250_dwlib.c:45:17: sparse:     expected unsigned int [usertype]
8250_dwlib.c:45:17: sparse:     got restricted __be32 [usertype]

One way is to use a lot of ifdeffery to properly use swab*() combination with
writel() or so, another is much simpler, i.e. forcing types, especially taking
into consideration the commit message of the original commit for that API.

Fixes: 25534eb77078 ("alpha: add io{read,write}{16,32}be functions")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
 arch/alpha/include/asm/io.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index a4d0c19f1e79..9529656c24bb 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -491,8 +491,8 @@ extern inline void writeq(u64 b, volatile void __iomem *addr)
 
 #define ioread16be(p) be16_to_cpu(ioread16(p))
 #define ioread32be(p) be32_to_cpu(ioread32(p))
-#define iowrite16be(v,p) iowrite16(cpu_to_be16(v), (p))
-#define iowrite32be(v,p) iowrite32(cpu_to_be32(v), (p))
+#define iowrite16be(v,p) iowrite16((__force u16)cpu_to_be16(v), (p))
+#define iowrite32be(v,p) iowrite32((__force u32)cpu_to_be32(v), (p))
 
 #define inb_p		inb
 #define inw_p		inw
-- 
2.27.0.rc2




[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux