summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-25 10:04:59 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-06 11:41:28 +0100
commitb26b7ef0f04d823e70f57684c8ee01277ade572a (patch)
tree135746b39e2ba4b6b68f7e4b8ad6829dd71a8968 /drivers/of
parent8a185a4ff2283c670ffc8724c1b7bdbf8d458cbe (diff)
downloadbarebox-b26b7ef0f04d823e70f57684c8ee01277ade572a.tar.gz
barebox-b26b7ef0f04d823e70f57684c8ee01277ade572a.tar.xz
of: Add root node argument to of_find_node_by_path
This makes of_find_node_by_path usable with multiple trees. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/base.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index ae1552444e..721db29537 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -146,7 +146,7 @@ void of_alias_scan(void)
INIT_LIST_HEAD(&aliases_lookup);
- of_aliases = of_find_node_by_path("/aliases");
+ of_aliases = of_find_node_by_path(root_node, "/aliases");
if (!of_aliases)
return;
@@ -163,7 +163,7 @@ void of_alias_scan(void)
!strcmp(pp->name, "linux,phandle"))
continue;
- np = of_find_node_by_path(pp->value);
+ np = of_find_node_by_path(root_node, pp->value);
if (!np)
continue;
@@ -483,18 +483,16 @@ EXPORT_SYMBOL(of_machine_is_compatible);
/**
* of_find_node_by_path - Find a node matching a full OF path
+ * @root: The root node of this tree
* @path: The full path to match
*
* Returns a node pointer with refcount incremented, use
* of_node_put() on it when done.
*/
-struct device_node *of_find_node_by_path(const char *path)
+struct device_node *of_find_node_by_path(struct device_node *root, const char *path)
{
char *slash, *p, *freep;
- struct device_node *dn = root_node;
-
- if (!root_node)
- return NULL;
+ struct device_node *dn = root;
if (*path != '/')
return NULL;
@@ -964,7 +962,7 @@ int of_probe(void)
if(!root_node)
return -ENODEV;
- of_chosen = of_find_node_by_path("/chosen");
+ of_chosen = of_find_node_by_path(root_node, "/chosen");
of_property_read_string(root_node, "model", &of_model);
__of_probe(root_node);
@@ -1193,7 +1191,7 @@ int of_device_is_stdout_path(struct device_d *dev)
name = of_get_property(of_chosen, "linux,stdout-path", NULL);
if (name == NULL)
return 0;
- dn = of_find_node_by_path(name);
+ dn = of_find_node_by_path(root_node, name);
if (!dn)
return 0;