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

Simon Glass sjg at chromium.org
Thu Jan 30 03:17:58 CET 2020


On Mon, 13 Jan 2020 at 03:35, 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
>
> 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 at st.com>
> ---
>
> Changes in v3:
> - add test dm_test_ofnode_get_property_by_prop
> - udpate ofnode example in commit message
> - solve comment for ofnode_get_property_by_prop (and not by of_ofprop)
>
> 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 ++++++++++++++++++++++++++++++++++++++++
>  test/dm/Makefile         |  1 +
>  test/dm/ofread.c         | 50 ++++++++++++++++++++++++++++++
>  8 files changed, 316 insertions(+), 1 deletion(-)
>  create mode 100644 test/dm/ofread.c
>

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list