Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-11-20 Thread Rob Herring
On 11/19/2012 10:45 PM, Viresh Kumar wrote: > This adds following helper routines: > - of_property_read_u8_array() > - of_property_read_u16_array() > - of_property_read_u8() > - of_property_read_u16() > > This expects arrays from DT to be passed as: > - u8 array: > property = /bits/ 8 <0x50

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-11-20 Thread Stephen Warren
On 11/19/2012 09:45 PM, Viresh Kumar wrote: > This adds following helper routines: > - of_property_read_u8_array() > - of_property_read_u16_array() > - of_property_read_u8() > - of_property_read_u16() > > This expects arrays from DT to be passed as: > - u8 array: > property = /bits/ 8 <0x50

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-11-20 Thread Viresh Kumar
On 20 November 2012 13:51, Shevchenko, Andriy wrote: > You could at least create macro to do a precheck if you want to. > > Like > #define CHECK_PROP(prop, sz, out) > > { > if (!prop) > return -EINVAL; > if (!prop->value) > return -ENODATA; > if ((sz

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-11-20 Thread Shevchenko, Andriy
On Tue, 2012-11-20 at 10:15 +0530, Viresh Kumar wrote: > This adds following helper routines: > - of_property_read_u8_array() > - of_property_read_u16_array() > - of_property_read_u8() > - of_property_read_u16() > > This expects arrays from DT to be passed as: > - u8 array: > property = /bi

[PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-11-19 Thread Viresh Kumar
This adds following helper routines: - of_property_read_u8_array() - of_property_read_u16_array() - of_property_read_u8() - of_property_read_u16() This expects arrays from DT to be passed as: - u8 array: property = /bits/ 8 <0x50 0x60 0x70>; - u16 array: property = /bits/ 16 <0x500

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-25 Thread Viresh Kumar
On 25 October 2012 19:48, Viresh Kumar wrote: > 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 c

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-25 Thread Viresh Kumar
On 25 October 2012 18:49, Rob Herring 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 h

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-25 Thread Rob Herring
On 10/25/2012 02:03 AM, Viresh Kumar wrote: > On 12 October 2012 23:31, Viresh Kumar wrote: >> This adds following helper routines: >> - of_property_read_u8_array() >> - of_property_read_u16_array() >> - of_property_read_u8() >> - of_property_read_u16() >> >> First two actually share most of the c

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-25 Thread Viresh Kumar
On 12 October 2012 23:31, Viresh Kumar wrote: > This adds following helper routines: > - of_property_read_u8_array() > - of_property_read_u16_array() > - of_property_read_u8() > - of_property_read_u16() > > First two actually share most of the code with of_property_read_u32_array(), > so > the co

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-15 Thread Viresh Kumar
On 15 October 2012 13:26, Shevchenko, Andriy wrote: > On Fri, 2012-10-12 at 23:31 +0530, Viresh Kumar wrote: >> + while (_sz--) \ >> + *_out++ = (_type)be32_to_cpup(_val++); \ > How about > *_out++ = (typeof(*_out)

Re: [PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-15 Thread Shevchenko, Andriy
On Fri, 2012-10-12 at 23:31 +0530, Viresh Kumar wrote: > This adds following helper routines: > - of_property_read_u8_array() > - of_property_read_u16_array() > - of_property_read_u8() > - of_property_read_u16() > > First two actually share most of the code with of_property_read_u32_array(), > s

[PATCH] dt: add helper function to read u8 & u16 variables & arrays

2012-10-12 Thread Viresh Kumar
This adds following helper routines: - of_property_read_u8_array() - of_property_read_u16_array() - of_property_read_u8() - of_property_read_u16() First two actually share most of the code with of_property_read_u32_array(), so the common part is taken out into a macro, which can be used by all thr