summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-17 18:43:47 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-06 11:41:27 +0100
commita75b5c5d8eca0ce1d5085e8e66301a78d7f39c64 (patch)
tree66b7e9988126c6f70c06cf8fb9a04ac4c5fb96aa /drivers/of
parent69c54bc9398bf33680f095c6495e957293a868bb (diff)
downloadbarebox-a75b5c5d8eca0ce1d5085e8e66301a78d7f39c64.tar.gz
barebox-a75b5c5d8eca0ce1d5085e8e66301a78d7f39c64.tar.xz
of: export of_find_child
of_find_child is a useful function. Export it and rename it to of_find_child_by_name. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/base.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d134f1ef3a..86dca6aa20 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -910,23 +910,13 @@ int of_probe(void)
return 0;
}
-static struct device_node *of_find_child(struct device_node *node, const char *name)
+struct device_node *of_find_child_by_name(struct device_node *node, const char *name)
{
struct device_node *_n;
- if (!root_node)
- return NULL;
-
- if (!node && !*name)
- return root_node;
-
- if (!node)
- node = root_node;
-
- list_for_each_entry(_n, &node->children, parent_list) {
+ device_node_for_nach_child(node, _n)
if (!strcmp(_n->name, name))
return _n;
- }
return NULL;
}
@@ -975,7 +965,7 @@ int of_unflatten_dtb(struct fdt_header *fdt)
if (!node) {
node = root;
} else {
- if ((n = of_find_child(node, pathp))) {
+ if ((n = of_find_child_by_name(node, pathp))) {
node = n;
} else {
node = of_new_node(node, pathp);