mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Krzysztof Halasa <khc@pm.waw.pl>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] Cosmetic: fix endianness convertions in read[wlq]().
Date: Sun, 6 May 2012 19:35:07 +0200	[thread overview]
Message-ID: <20120506173507.GV4141@pengutronix.de> (raw)
In-Reply-To: <m3k40qmhsn.fsf@intrepid.localdomain>

On Sat, May 05, 2012 at 11:36:40PM +0200, Krzysztof Halasa wrote:
> Signed-off-by: Krzysztof Hałasa <khc@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 |

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

  reply	other threads:[~2012-05-06 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05 21:36 Krzysztof Halasa
2012-05-06 17:35 ` Sascha Hauer [this message]
2012-05-06 20:08   ` Krzysztof Halasa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120506173507.GV4141@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=khc@pm.waw.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox