Skip to content

Commit

Permalink
net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data
Browse files Browse the repository at this point in the history
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: <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: David S. Miller <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Acked-by: Nicolas Pitre <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
wildea01 authored and davem330 committed Oct 11, 2013
1 parent 96b3404 commit e9e4ea7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/ethernet/smsc/smc91x.h
Original file line number Diff line number Diff line change
Expand Up @@ -1124,17 +1124,15 @@ static const char * chip_ids[ 16 ] = {
void __iomem *__ioaddr = ioaddr; \
if (__len >= 2 && (unsigned long)__ptr & 2) { \
__len -= 2; \
SMC_outw(*(u16 *)__ptr, ioaddr, \
DATA_REG(lp)); \
SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
__ptr += 2; \
} \
if (SMC_CAN_USE_DATACS && lp->datacs) \
__ioaddr = lp->datacs; \
SMC_outsl(__ioaddr, DATA_REG(lp), __ptr, __len>>2); \
if (__len & 2) { \
__ptr += (__len & ~3); \
SMC_outw(*((u16 *)__ptr), ioaddr, \
DATA_REG(lp)); \
SMC_outsw(ioaddr, DATA_REG(lp), __ptr, 1); \
} \
} else if (SMC_16BIT(lp)) \
SMC_outsw(ioaddr, DATA_REG(lp), p, (l) >> 1); \
Expand Down

0 comments on commit e9e4ea7

Please sign in to comment.