summaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-06-13 20:34:33 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-06-20 21:20:54 +0200
commitb45e2c0b47c52ccb68d74b7b79b5226b9a944bff (patch)
tree60dd0564ae1470fe4570ef1027276c9dca44ab51 /drivers/of/base.c
parent8b362a690b6fc1e3dc1e2da6dc612274fa6d133b (diff)
downloadbarebox-b45e2c0b47c52ccb68d74b7b79b5226b9a944bff.tar.gz
barebox-b45e2c0b47c52ccb68d74b7b79b5226b9a944bff.tar.xz
OF: base: import of_find_node_with_property from Linux OF API
This imports of_find_node_with_property and corresponding helpers from Linux OF API. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 490d2dbbd2..50153b5908 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -368,6 +368,32 @@ struct device_node *of_find_compatible_node(struct device_node *from,
EXPORT_SYMBOL(of_find_compatible_node);
/**
+ * of_find_node_with_property - Find a node which has a property with
+ * the given name.
+ * @from: The 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.
+ * @prop_name: The name of the property to look for.
+ *
+ * Returns a pointer to the node found or NULL.
+ */
+struct device_node *of_find_node_with_property(struct device_node *from,
+ const char *prop_name)
+{
+ struct device_node *np;
+
+ of_tree_for_each_node(np, from) {
+ struct property *pp = of_find_property(np, prop_name, NULL);
+ if (pp)
+ return np;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL(of_find_node_with_property);
+
+/**
* of_match_node - Tell if an device_node has a matching of_match structure
* @matches: array of of device match structures to search in
* @node: the of device structure to match against