From: Jeremy Kerr <jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
To: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: 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 11:29:52 +0800 [thread overview]
Message-ID: <1284434992.2877.143.camel@pororo> (raw)
In-Reply-To: <AANLkTi=ODinhAG6L62FGiA61nZkDEYweSThWW9J8BwXb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Timur,
> 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);
If your code will be run on little-endian platforms, you'll need to do
this, yes. It may also be prudent to do this on BE platforms too, as
we'll undoubtedly have someone copy code from one to another. But I
don't think anyone is suggesting that we modify existing BE-only code.
Also, in the example you have given, I think be32_to_cpup(iprop) is
preferred.
Cheers,
Jeremy
next prev parent reply other threads:[~2010-09-14 3:29 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
2010-09-14 3:29 ` Jeremy Kerr [this message]
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=1284434992.2877.143.camel@pororo \
--to=jeremy.kerr-z7wlfzj8ewms+fvcfc7uqw@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.