[PATCH v2 02/14] dm: core: add ofnode and dev function to iterate on node property

Patrick DELAUNAY patrick.delaunay at st.com
Thu Jan 9 09:29:55 CET 2020


Hi,

> From: Simon Glass <sjg at chromium.org>
> Sent: lundi 30 décembre 2019 02:21
> 
> On Tue, 26 Nov 2019 at 01:49, Patrick Delaunay <patrick.delaunay at st.com>
> wrote:
> >
> > Add functions to iterate on all property with livetree
> > - dev_read_first_prop
> > - dev_read_next_prop
> > - dev_read_prop_by_prop
> > and
> > - ofnode_get_first_property
> > - ofnode_get_next_property
> > - ofnode_get_property_by_prop
> >
> > For example:
> > struct ofprop property;
> >
> > dev_for_each_property(property, config) {
> >         value = dev_read_prop_by_prop(&property, &propname, &len);
> >
> > or:
> > for (prop = ofnode_get_first_property(dev_ofnode(dev));
> >      prop;
> >      prop = ofnode_get_next_property(dev_ofnode(dev),prop))
> > {
> >      value = ofnode_get_property_by_prop(dev_ofnode(dev), prop,
> >                                          &propname, &len); ....
> > }
> >
> > Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> > ---
> >
> > Changes in v2:
> > - Identify property with a new struct ofprop as proposed
> >   by Simon Glass
> > - Add dev_ iterate functions
> >
> >  drivers/core/of_access.c | 32 +++++++++++++++++++
> >  drivers/core/ofnode.c    | 48 ++++++++++++++++++++++++++++
> >  drivers/core/read.c      | 16 ++++++++++
> >  include/dm/of_access.h   | 40 ++++++++++++++++++++++++
> >  include/dm/ofnode.h      | 63 ++++++++++++++++++++++++++++++++++++-
> >  include/dm/read.h        | 67
> ++++++++++++++++++++++++++++++++++++++++
> >  6 files changed, 265 insertions(+), 1 deletion(-)
> 
> These look good, but please add a few simple tests like in your commit message.
> 
> See test/dm/ofnode.c, or you could add test/dm/read.c and just use the read
> interface which would be good enough It think, since tests run with and without
> livetree.

Ok I will add  it.

Regards
Patrick


More information about the U-Boot mailing list