Re: [PATCH] Cosmetic: fix endianness convertions in read[wlq]().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> writes:

>> -#define readw(addr) __le16_to_cpu(__raw_readw(addr))
>> -#define readl(addr) __le32_to_cpu(__raw_readl(addr))
>> +#define readw(addr) __cpu_to_le16(__raw_readw(addr))
>> +#define readl(addr) __cpu_to_le32(__raw_readl(addr))
>
> This seems wrong. readw/l are supposed to do little endian reads and that
> is exactly what the code you remove does: It reads in cpu native
> endianess and interprets that as a little endian word which is then
> converted into cpu native endian word.
> (Also the code is copied from the kernel which makes me quite confident
> that it's correct)

Well... That's right. I forgot the PCI on ARM is set in order-preserving
mode. This means that while the peripherals (u32) are accessed simply
with __raw_readl(), on PCI bus __raw_readl() yields wrong-endian value
(le32 instead of u32). I wonder how it passes sparse.
-- 
Krzysztof Halasa

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux