Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays
From: Viresh Kumar
Date: Thu Oct 25 2012 - 10:18:03 EST
On 25 October 2012 18:49, Rob Herring <robherring2@xxxxxxxxx> wrote:
> For some reason, this does not show up on the list either in my mail or
> mail list archives, but it is in patchwork. Can you resend it please.
Strange. I kept you in --to field. I know people added in cc are
sometimes removed
by the list when they have selected "avoid duplicate mails" option for
their list.
> The main question I have is be32_to_cpup() the right thing to do. I
> would expect byte arrays to not need endian conversion, but I haven't
> looked at how '/bits/ x' data is stored.
The problem i see here is:
The data passed via DT comes as Little Endian in the kernel.
For a little endian system, byte zero will contain the data and so
(u8) val
look to be the correct thing.
For a big endian system, byte 3 will contain data as it is swapped by
be32_to_cpup.
So (u8) val would return value stored by byte 0 instead. ??
Does my logic look correct to you??
--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/