aboutsummaryrefslogtreecommitdiff
path: root/drivers/of/resolver.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2017-06-02 12:43:18 -0500
committerRob Herring <robh@kernel.org>2017-06-22 12:38:29 -0500
commit27497e11b56a072dfd80e9f1f229049b2921a1a6 (patch)
tree99a9bcbc25e186d8f8644945e6fc865e02a60b01 /drivers/of/resolver.c
parent95e6b1fa3311c8a7b151d38540695409048d1495 (diff)
downloadlinux-stericsson-27497e11b56a072dfd80e9f1f229049b2921a1a6.tar.gz
of: find_node_by_full_name rewrite to compare each level
find_node_by_full_name() does the same thing as of_find_node_by_path(), but takes no locks and doesn't work on aliases. Refactor of_find_node_opts_by_path() into __of_find_node_by_full_path() and replace find_node_by_full_name() with it. Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of/resolver.c')
-rw-r--r--drivers/of/resolver.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/drivers/of/resolver.c b/drivers/of/resolver.c
index 63626d7d9adb..99309cb7d372 100644
--- a/drivers/of/resolver.c
+++ b/drivers/of/resolver.c
@@ -20,35 +20,11 @@
#include <linux/errno.h>
#include <linux/slab.h>
+#include "of_private.h"
+
/* illegal phandle value (set when unresolved) */
#define OF_PHANDLE_ILLEGAL 0xdeadbeef
-/**
- * Find a node with the give full name by recursively following any of
- * the child node links.
- */
-static struct device_node *find_node_by_full_name(struct device_node *node,
- const char *full_name)
-{
- struct device_node *child, *found;
-
- if (!node)
- return NULL;
-
- if (!of_node_cmp(node->full_name, full_name))
- return of_node_get(node);
-
- for_each_child_of_node(node, child) {
- found = find_node_by_full_name(child, full_name);
- if (found != NULL) {
- of_node_put(child);
- return found;
- }
- }
-
- return NULL;
-}
-
static phandle live_tree_max_phandle(void)
{
struct device_node *node;
@@ -138,7 +114,7 @@ static int update_usages_of_a_phandle_reference(struct device_node *overlay,
if (err)
goto err_fail;
- refnode = find_node_by_full_name(overlay, node_path);
+ refnode = __of_find_node_by_full_path(of_node_get(overlay), node_path);
if (!refnode)
continue;