Commit e9e4ea74 authored by Will Deacon's avatar Will Deacon Committed by David S. Miller

net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data

SMC_outw invokes an endian-aware I/O accessor, which may change the data
endianness before writing to the device. This is not suitable for data
transfers where the memory buffer is simply a string of bytes that does
not require any byte-swapping.

This patches fixes the smc91x SMC_PUSH_DATA macro so that it uses the
string I/O accessor for outputting the leading or trailing halfwords on
halfword-aligned buffers.

Cc: <netdev@vger.kernel.org>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 96b34040
...@@ -1124,8 +1124,7 @@ static const char * chip_ids[ 16 ] = { ...@@ -1124,8 +1124,7 @@ static const char * chip_ids[ 16 ] = {
void __iomem *__ioaddr = ioaddr; \ void __iomem *__ioaddr = ioaddr; \
if (__len >= 2 && (unsigned long)__ptr & 2) { \ if (__len >= 2 && (unsigned long)__ptr & 2) { \
__len -= 2; \ __len -= 2; \
SMC_outw(*(u16 *)__ptr, ioaddr, \ SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
DATA_REG(lp)); \
__ptr += 2; \ __ptr += 2; \
} \ } \
if (SMC_CAN_USE_DATACS && lp->datacs) \ if (SMC_CAN_USE_DATACS && lp->datacs) \
...@@ -1133,8 +1132,7 @@ static const char * chip_ids[ 16 ] = { ...@@ -1133,8 +1132,7 @@ static const char * chip_ids[ 16 ] = {
SMC_outsl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \ SMC_outsl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \
if (__len & 2) { \ if (__len & 2) { \
__ptr += (__len & ~3); \ __ptr += (__len & ~3); \
SMC_outw(*((u16 *)__ptr), ioaddr, \ SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
DATA_REG(lp)); \
} \ } \
} else if (SMC_16BIT(lp)) \ } else if (SMC_16BIT(lp)) \
SMC_outsw(ioaddr, DATA_REG(lp), p, (l) >> 1); \ SMC_outsw(ioaddr, DATA_REG(lp), p, (l) >> 1); \
......
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