From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: [PATCH] drivers/of: use __be32 types for big-endian device tree data
Date: Tue, 14 Sep 2010 13:23:21 +1000 [thread overview]
Message-ID: <20100914032321.GJ13154@yookeroo> (raw)
In-Reply-To: <AANLkTi=ODinhAG6L62FGiA61nZkDEYweSThWW9J8BwXb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Mon, Sep 13, 2010 at 10:20:11PM -0500, Timur Tabi wrote:
> On Mon, Sep 13, 2010 at 10:13 PM, Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
> > Use the sparse annotations so we can keep track of endianness.
> >
> > Signed-off-by: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
>
> Does this mean that I should be using be32_to_cpu() whenever I
> dereference a pointer to a u32 in the device tree? Currently, I do
> this:
>
> const u32 *iprop;
> const u32 num;
> iprop = of_get_property(np, ...)
> num = *iprop;
>
> Should I be doing this instead?
>
> const __be32 *iprop;
> const u32 num;
> iprop = of_get_property(np, ...)
> num = be32_to_cpu(*iprop);
Yes.
Although, we should probably add a get_intprop() or similar helper
that will do this for you.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2010-09-14 3:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-14 3:13 [PATCH] drivers/of: use __be32 types for big-endian device tree data Jeremy Kerr
2010-09-14 3:20 ` Timur Tabi
[not found] ` <AANLkTi=ODinhAG6L62FGiA61nZkDEYweSThWW9J8BwXb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-09-14 3:23 ` David Gibson [this message]
2010-09-14 3:29 ` Jeremy Kerr
2010-09-15 18:57 ` Grant Likely
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=20100914032321.GJ13154@yookeroo \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
/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