dm: core: add ofnode and dev function to iterate on node property
authorPatrick Delaunay <patrick.delaunay@st.com>
Mon, 13 Jan 2020 10:34:56 +0000 (11:34 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 17 Apr 2020 03:06:54 +0000 (23:06 -0400)
commitce891fcada6638c39a0de28f821cfa2b9406440c
treee3b91f3dea700a91ae783c19711da482ee200b51
parent719cab6d2e2bf86f141a2c018b4e8e6c1507a5eb
dm: core: add ofnode and dev function to iterate on node property

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

And helper: dev_for_each_property

For example:
struct ofprop property;

dev_for_each_property(property, config) {
value = dev_read_prop_by_prop(&property, &propname, &len);

or:

for (res = ofnode_get_first_property(node, &property);
     !res;
     res = ofnode_get_next_property(&property))
{
     value = ofnode_get_property_by_prop(&property, &propname, &len);
....
}

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/core/of_access.c
drivers/core/ofnode.c
drivers/core/read.c
include/dm/of_access.h
include/dm/ofnode.h
include/dm/read.h
test/dm/Makefile
test/dm/ofread.c [new file with mode: 0644]