On Fri, Feb 24, 2012 at 03:29:04PM -0600, Timur Tabi wrote:
Russell King - ARM Linux wrote:
I'll have to ask around, because I'm sure I'm missing something.
If what you say is true, it means we have different semantics for the same accessors on different architectures. No wonder it's needing drivers to gain ifdefs to select appropriate accessors.
This needs sorting out properly. It needs the semantics of readl() etc to be fully defined, and all architectures to implement those semantics rather than what they think would be appropriate for them.
So I asked around, and sure enough, my macro-fu was weak. On PowerPC, readl() maps to in_le32(). Even though PowerPC is big-endian, some devices are little endian (e.g. PCI and some PICs).
in_le32() is the byte-swapping version of in_be32(). Both functions have instruction order synchronization instructions in them.
So replacing in_be32() with readl() will break on PowerPC.
But not a BE variant. Like ioread32be().
BenH tells me that he'll accept patches which converts in_32be() to ioread32be(), as in_32be() is ancient PPC cruft that needs to die.