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

Sascha Hauer s.hauer at pengutronix.de
Sun May 6 13:35:07 EDT 2012


On Sat, May 05, 2012 at 11:36:40PM +0200, Krzysztof Halasa wrote:
> Signed-off-by: Krzysztof Hałasa <khc at pm.waw.pl>
> 
> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
> index 3f0f5a2..8480acf 100644
> --- a/include/asm-generic/io.h
> +++ b/include/asm-generic/io.h
> @@ -35,8 +35,8 @@
>  #endif
>  
>  #define readb __raw_readb
> -#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)

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list