summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>2013-06-13 18:06:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-06-20 21:20:50 +0200
commit0b79c3bb641857f5045a42f55f0b90d160706425 (patch)
tree10ce0b10a34032f30d73337ea48b3f7cdbcffe34 /commands
parent905f3ee7fb79af91ed42275c995ca0cd04a2a3d6 (diff)
downloadbarebox-0b79c3bb641857f5045a42f55f0b90d160706425.tar.gz
barebox-0b79c3bb641857f5045a42f55f0b90d160706425.tar.xz
OF: base: sync of_find_node_by_path with linux OF API
Barebox of_find_node_by_path requires a node to be passed as start node to start searching. Linux OF API does not pass this node and no current user of it in barebox is passing anything else than the root node. Therefore, we rename current function to of_find_node_by_path_from and introduce a Linux OF API compatible of_find_node_by_path that always passes the current root_node. Also, all current users of that function are updated to reflect the API change. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/of_node.c2
-rw-r--r--commands/of_property.c10
-rw-r--r--commands/oftree.c11
3 files changed, 4 insertions, 19 deletions
diff --git a/commands/of_node.c b/commands/of_node.c
index 0249d9725b..e60ef66d38 100644
--- a/commands/of_node.c
+++ b/commands/of_node.c
@@ -81,7 +81,7 @@ static int do_of_node(int argc, char *argv[])
if (!path)
return COMMAND_ERROR_USAGE;
- node = of_find_node_by_path(root, path);
+ node = of_find_node_by_path(path);
if (!node) {
printf("Cannot find nodepath %s\n", path);
return -ENOENT;
diff --git a/commands/of_property.c b/commands/of_property.c
index d1a9a17c55..8ffe30b25f 100644
--- a/commands/of_property.c
+++ b/commands/of_property.c
@@ -175,7 +175,7 @@ static int do_of_property(int argc, char *argv[])
int set = 0;
int ret;
char *path = NULL, *propname = NULL;
- struct device_node *root, *node = NULL;
+ struct device_node *node = NULL;
struct property *pp = NULL;
while ((opt = getopt(argc, argv, "ds")) > 0) {
@@ -194,15 +194,9 @@ static int do_of_property(int argc, char *argv[])
if (optind == argc)
return COMMAND_ERROR_USAGE;
- root = of_get_root_node();
- if (!root) {
- printf("root node not set\n");
- return -ENOENT;
- }
-
if (optind < argc) {
path = argv[optind];
- node = of_find_node_by_path(root, path);
+ node = of_find_node_by_path(path);
if (!node) {
printf("Cannot find nodepath %s\n", path);
return -ENOENT;
diff --git a/commands/oftree.c b/commands/oftree.c
index 468235a043..914951735b 100644
--- a/commands/oftree.c
+++ b/commands/oftree.c
@@ -164,16 +164,7 @@ static int do_oftree(int argc, char *argv[])
of_print_nodes(root, 0);
of_free(root);
} else {
- struct device_node *root, *n;
-
- root = of_get_root_node();
- if (!root) {
- ret = -ENOENT;
- goto out;
- }
-
- n = of_find_node_by_path(root, node);
-
+ struct device_node *n = of_find_node_by_path(node);
if (!n) {
ret = -ENOENT;
goto out;