Commit d4aa8aff authored by Greg Ungerer's avatar Greg Ungerer

m68knommu: fix use of cpu_to_le() on IO access

Due to the different data endian requirements of different buses on
m68knommu variants we sometimes need to byte swap results for readX()
or values to writeX(). Currently the code uses cpu_to_le to do this,
resulting in sparse warnings like:

arch/m68k/include/asm/io_no.h:78:16: sparse: sparse: cast to restricted __le32

Some casting to force __le32 types would resolve but it looks to be
simpler to just switch to using the underlying swab32() to resolve.

Similarly handle the 16bit cases in these functions as well.
Reported-by: default avatarkernel test robot <lkp@intel.com>
CC: Marc Kleine-Budde <mkl@pengutronix.de>
Reviewed-by: default avatarLuc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: default avatarGreg Ungerer <gerg@linux-m68k.org>
parent 005b73d0
...@@ -67,7 +67,7 @@ static inline u16 readw(const volatile void __iomem *addr) ...@@ -67,7 +67,7 @@ static inline u16 readw(const volatile void __iomem *addr)
{ {
if (cf_internalio(addr)) if (cf_internalio(addr))
return __raw_readw(addr); return __raw_readw(addr);
return __le16_to_cpu(__raw_readw(addr)); return swab16(__raw_readw(addr));
} }
#define readl readl #define readl readl
...@@ -75,7 +75,7 @@ static inline u32 readl(const volatile void __iomem *addr) ...@@ -75,7 +75,7 @@ static inline u32 readl(const volatile void __iomem *addr)
{ {
if (cf_internalio(addr)) if (cf_internalio(addr))
return __raw_readl(addr); return __raw_readl(addr);
return __le32_to_cpu(__raw_readl(addr)); return swab32(__raw_readl(addr));
} }
#define writew writew #define writew writew
...@@ -84,7 +84,7 @@ static inline void writew(u16 value, volatile void __iomem *addr) ...@@ -84,7 +84,7 @@ static inline void writew(u16 value, volatile void __iomem *addr)
if (cf_internalio(addr)) if (cf_internalio(addr))
__raw_writew(value, addr); __raw_writew(value, addr);
else else
__raw_writew(__cpu_to_le16(value), addr); __raw_writew(swab16(value), addr);
} }
#define writel writel #define writel writel
...@@ -93,7 +93,7 @@ static inline void writel(u32 value, volatile void __iomem *addr) ...@@ -93,7 +93,7 @@ static inline void writel(u32 value, volatile void __iomem *addr)
if (cf_internalio(addr)) if (cf_internalio(addr))
__raw_writel(value, addr); __raw_writel(value, addr);
else else
__raw_writel(__cpu_to_le32(value), addr); __raw_writel(swab32(value), addr);
} }
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment