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

Viresh Kumar viresh.kumar at linaro.org
Tue Nov 20 19:25:03 EST 2012


On 20 November 2012 13:51, Shevchenko, Andriy
<andriy.shevchenko at intel.com> 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 * sizeof(*out)) > prop->length)
>                 return -EOVERFLOW;
> }

Hi Andriy,

Initially i started with a macro for the complete routine, but later as types
started to play important role in it, i have to split it to routines.

I thought of this idea to do prop check in a macro, but then i thought
it might cover a bigger range of files and so thought of doing that separately.
For, simplicity left it this time.

--
viresh


More information about the devicetree-discuss mailing list