Skip to content

Commit d4aa8af

Browse files
author
Greg Ungerer
committed
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: kernel test robot <[email protected]> CC: Marc Kleine-Budde <[email protected]> Reviewed-by: Luc Van Oostenryck <[email protected]> Signed-off-by: Greg Ungerer <[email protected]>
1 parent 005b73d commit d4aa8af

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/m68k/include/asm/io_no.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ static inline u16 readw(const volatile void __iomem *addr)
6767
{
6868
if (cf_internalio(addr))
6969
return __raw_readw(addr);
70-
return __le16_to_cpu(__raw_readw(addr));
70+
return swab16(__raw_readw(addr));
7171
}
7272

7373
#define readl readl
7474
static inline u32 readl(const volatile void __iomem *addr)
7575
{
7676
if (cf_internalio(addr))
7777
return __raw_readl(addr);
78-
return __le32_to_cpu(__raw_readl(addr));
78+
return swab32(__raw_readl(addr));
7979
}
8080

8181
#define writew writew
@@ -84,7 +84,7 @@ static inline void writew(u16 value, volatile void __iomem *addr)
8484
if (cf_internalio(addr))
8585
__raw_writew(value, addr);
8686
else
87-
__raw_writew(__cpu_to_le16(value), addr);
87+
__raw_writew(swab16(value), addr);
8888
}
8989

9090
#define writel writel
@@ -93,7 +93,7 @@ static inline void writel(u32 value, volatile void __iomem *addr)
9393
if (cf_internalio(addr))
9494
__raw_writel(value, addr);
9595
else
96-
__raw_writel(__cpu_to_le32(value), addr);
96+
__raw_writel(swab32(value), addr);
9797
}
9898

9999
#else

0 commit comments

Comments
 (0)