[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B7145@saturn3.aculab.com>
Date: Tue, 12 Feb 2013 09:19:52 -0000
From: "David Laight" <David.Laight@...LAB.COM>
To: "Ben Dooks" <ben.dooks@...ethink.co.uk>,
"Ben Hutchings" <bhutchings@...arflare.com>
Cc: <netdev@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
"Rob Herring" <rob.herring@...xeda.com>,
<linux-arm-kernel@...ts.infradead.org>
Subject: RE: [PATCH 2/2] net: calexdaxgmac: fixup endian issues after __raw IO function change
> > You are using le32_to_cpu() and cpu_to_le32() the wrong way round, and
> > then putting casts on the wrong side, i.e. it should be:
> >
> > value = le32_to_cpu((__force __le32)__raw_readl(addr));
> > __raw_writel((__force u32)cpu_to_le32(value), addr);
> >
> > (I do wonder why __raw I/O functions aren't declared to take/return __le
> > types... it would avoid the need to cast altogether.)
>
> Because they do things with the order the cpu is working in, the
> read{x} and write{x} transfer cpu to bus-endian so returning an __le
> type would not be correct.
Surely you want to arrange to use the byte-swapping memory
read/write instructions, rather than byteswapping the value.
Particularly on ppc which doesn't have a byteswap instruction
but can do byteswapping memory accesses.
David
Powered by blists - more mailing lists