9
0
Fork 0

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>
This commit is contained in:
Sascha Hauer 2013-02-17 18:43:47 +01:00
parent 69c54bc939
commit a75b5c5d8e
2 changed files with 5 additions and 13 deletions

View File

@ -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);

View File

@ -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) \