
On Tue, 26 Nov 2019 at 01:49, Patrick Delaunay patrick.delaunay@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@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.
Regards, Simon