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/of_access.h | 16 ++++++++++++++++ include/dm/ofnode.h | 14 ++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'include/dm') diff --git a/include/dm/of_access.h b/include/dm/of_access.h index dd1abb8e97b..5ed1a0cdb42 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -193,6 +193,22 @@ static inline struct device_node *of_find_node_by_path(const char *path) struct device_node *of_find_compatible_node(struct device_node *from, const char *type, const char *compatible); +/** + * of_find_node_by_prop_value() - find a node with a given property value + * + * Find a node based on a property value. + * @from: Node to start searching from or NULL. the node you pass will not be + * searched, only the next one will; typically, you pass what the previous + * call returned. + * @propname: property name to check + * @propval: property value to search for + * @proplen: length of the value in propval + * @return node pointer or NULL if not found + */ +struct device_node *of_find_node_by_prop_value(struct device_node *from, + const char *propname, + const void *propval, + int proplen); /** * of_find_node_by_phandle() - Find a node given a phandle * 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.3.1 From 75629a25087cd9897305375421abe2248bc40e72 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 7 Sep 2018 07:51:52 -0700 Subject: dm: uclass: Adding missing child_pre_probe description The comment of child_pre_probe, one of the 'struct uclass_driver' members, is currently missing. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- include/dm/uclass.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/dm') diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 0e882cec59c..6e7c1cd3e8b 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -58,6 +58,7 @@ struct udevice; * @post_probe: Called after a new device is probed * @pre_remove: Called before a device is removed * @child_post_bind: Called after a child is bound to a device in this uclass + * @child_pre_probe: Called before a child is probed in this uclass * @init: Called to set up the uclass * @destroy: Called to destroy the uclass * @priv_auto_alloc_size: If non-zero this is the size of the private data -- cgit v1.3.1