On Friday 15 May 2015 07:14:08 Timur Tabi wrote:
Arnd Bergmann wrote:
Then please remove the double-swap. If the device works like any other device in the system, then the byteswap that is implied by readl/writel will do the right thing, and swapping twice will break big-endian kernels.
Should I still keep the __le32 in the structs?
Not sure about that. Most people use offsets with a void * pointer, so they would not care.
Do you get a sparse warning if you either leave the __le32, or if you turn it into u32? The correct behavior is probably to leave __le32 here, and ensure that readl() produces a sparse warning when fed with a pointer to u32, but not void* or __le32*. It would need some experimenting to find if that catches real bugs or just starts warning about correct code and not about incorrect code.
FWIW, the drivers you cited that use le32_to_cpu(readl(p)) are probably all wrong, and it would be nice to have a sparse warning for that.
Arnd