[PATCH] drivers/of: use __be32 types for big-endian device tree data

Timur Tabi timur at freescale.com
Tue Sep 14 13:20:11 EST 2010


On Mon, Sep 13, 2010 at 10:13 PM, Jeremy Kerr <jeremy.kerr at canonical.com> wrote:
> Use the sparse annotations so we can keep track of endianness.
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr at canonical.com>

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);

-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the devicetree-discuss mailing list