[PATCH 02/37] of: export of_find_child
Sascha Hauer
s.hauer at pengutronix.de
Mon Mar 4 04:53:05 EST 2013
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 at pengutronix.de>
---
drivers/of/base.c | 16 +++-------------
include/of.h | 2 ++
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d134f1e..86dca6a 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);
diff --git a/include/of.h b/include/of.h
index 95d9702..f3fc2ae 100644
--- a/include/of.h
+++ b/include/of.h
@@ -72,6 +72,8 @@ struct property *of_find_property(const struct device_node *node, const char *na
struct device_node *of_find_node_by_path(const char *path);
+struct device_node *of_find_child_by_name(struct device_node *node, const char *name);
+
struct fdt_header *fdt_get_tree(void);
#define device_node_for_nach_child(node, child) \
--
1.7.10.4
More information about the barebox
mailing list