* [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data [not found] <1381499540-28794-1-git-send-email-matthew.leach@arm.com> @ 2013-10-11 13:52 ` Matthew Leach 2013-10-11 20:41 ` Nicolas Pitre 2013-10-11 21:56 ` David Miller 0 siblings, 2 replies; 3+ messages in thread From: Matthew Leach @ 2013-10-11 13:52 UTC (permalink / raw) To: linux-arm-kernel Cc: ankit.jindal, steve.mcintyre, tushar.jagad, will.deacon, catalin.marinas, netdev, Nicolas Pitre, David S. Miller From: Will Deacon <will.deacon@arm.com> 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: Will Deacon <will.deacon@arm.com> --- drivers/net/ethernet/smsc/smc91x.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 5730fe2..98eedb9 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h @@ -1124,8 +1124,7 @@ 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) \ @@ -1133,8 +1132,7 @@ static const char * chip_ids[ 16 ] = { 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); \ -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data 2013-10-11 13:52 ` [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data Matthew Leach @ 2013-10-11 20:41 ` Nicolas Pitre 2013-10-11 21:56 ` David Miller 1 sibling, 0 replies; 3+ messages in thread From: Nicolas Pitre @ 2013-10-11 20:41 UTC (permalink / raw) To: Matthew Leach Cc: linux-arm-kernel, ankit.jindal, steve.mcintyre, tushar.jagad, will.deacon, catalin.marinas, netdev, David S. Miller On Fri, 11 Oct 2013, Matthew Leach wrote: > From: Will Deacon <will.deacon@arm.com> > > 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. Acked-by: Nicolas Pitre <nico@linaro.org> > > Cc: <netdev@vger.kernel.org> > Cc: Nicolas Pitre <nico@fluxnic.net> > Cc: David S. Miller <davem@davemloft.net> > Signed-off-by: Will Deacon <will.deacon@arm.com> > --- > drivers/net/ethernet/smsc/smc91x.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h > index 5730fe2..98eedb9 100644 > --- a/drivers/net/ethernet/smsc/smc91x.h > +++ b/drivers/net/ethernet/smsc/smc91x.h > @@ -1124,8 +1124,7 @@ 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) \ > @@ -1133,8 +1132,7 @@ static const char * chip_ids[ 16 ] = { > 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); \ > -- > 1.7.9.5 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data 2013-10-11 13:52 ` [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data Matthew Leach 2013-10-11 20:41 ` Nicolas Pitre @ 2013-10-11 21:56 ` David Miller 1 sibling, 0 replies; 3+ messages in thread From: David Miller @ 2013-10-11 21:56 UTC (permalink / raw) To: matthew.leach Cc: linux-arm-kernel, ankit.jindal, steve.mcintyre, tushar.jagad, will.deacon, catalin.marinas, netdev, nico From: Matthew Leach <matthew.leach@arm.com> Date: Fri, 11 Oct 2013 14:52:20 +0100 > From: Will Deacon <will.deacon@arm.com> > > 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: Will Deacon <will.deacon@arm.com> Applied. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-11 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1381499540-28794-1-git-send-email-matthew.leach@arm.com>
2013-10-11 13:52 ` [PATCH 14/14] net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data Matthew Leach
2013-10-11 20:41 ` Nicolas Pitre
2013-10-11 21:56 ` David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).