From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 29 Dec 2019 18:21:07 -0700 Subject: [PATCH v2 02/14] dm: core: add ofnode and dev function to iterate on node property In-Reply-To: <20191126084911.19761-3-patrick.delaunay@st.com> References: <20191126084911.19761-1-patrick.delaunay@st.com> <20191126084911.19761-3-patrick.delaunay@st.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, 26 Nov 2019 at 01:49, Patrick Delaunay 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 > --- > > 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. Regards, Simon