From 61fba0faba432ae1cefc3984f863c28880d30329 Mon Sep 17 00:00:00 2001 From: Jens Wiklander Date: Mon, 20 Aug 2018 11:09:58 +0200 Subject: ofnode: add ofnode_by_prop_value() Adds ofnode_by_prop_value() to search for nodes with a given property and value, an ofnode version of fdt_node_offset_by_prop_value(). Signed-off-by: Jens Wiklander Reviewed-by: Simon Glass --- include/dm/ofnode.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/dm/ofnode.h') diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index ab36b74c4ca..c06d77849c7 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -702,6 +702,20 @@ int ofnode_read_resource_byname(ofnode node, const char *name, */ ofnode ofnode_by_compatible(ofnode from, const char *compat); +/** + * ofnode_by_prop_value() - Find the next node with given property value + * + * Find the next node after @from that has a @propname with a value + * @propval and a length @proplen. + * + * @from: ofnode to start from (use ofnode_null() to start at the + * beginning) @propname: property name to check @propval: property value to + * search for @proplen: length of the value in propval @return ofnode + * found, or ofnode_null() if none + */ +ofnode ofnode_by_prop_value(ofnode from, const char *propname, + const void *propval, int proplen); + /** * ofnode_for_each_subnode() - iterate over all subnodes of a parent * -- cgit v1.2.3