lkml.org 
[lkml]   [2012]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] dt: add helper function to read u8 & u16 variables & arrays
From
On 25 October 2012 18:49, Rob Herring <robherring2@gmail.com> 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


\
 
 \ /
  Last update: 2012-10-26 11:21    [W:0.048 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site