[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <537C137B.2000007@gmail.com>
Date: Tue, 20 May 2014 19:46:19 -0700
From: Frank Rowand <frowand.list@...il.com>
To: Grant Likely <grant.likely@...aro.org>
CC: linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
David Daney <david.daney@...ium.com>,
Pantelis Antoniou <pantelis.antoniou@...sulko.com>
Subject: Re: [PATCH 2/3] of: Make of_find_node_by_path() handle /aliases
On 5/20/2014 7:41 PM, Frank Rowand wrote:
< snip >
> I will reply to this email with an additional patch that restores the
> original behavior.
< snip >
From: Frank Rowand <frank.rowand@...ymobile.com>
If __of_find_node_by_path() returns parent when the remaining portion of the
path is "/" then the behavior of of_find_node_by_path() has changed.
Previously, adding an extraneous "/" on the end of a path would result
in of_find_node_by_path() not finding a match.
Signed-off-by: Frank Rowand <frank.rowand@...ymobile.com>
---
drivers/of/base.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
Index: b/drivers/of/base.c
===================================================================
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -778,7 +778,7 @@ static struct device_node *__of_find_nod
int len = strchrnul(path, '/') - path;
if (!len)
- return parent;
+ return NULL;
for_each_child_of_node(parent, child) {
const char *name = strrchr(child->full_name, '/');
@@ -813,6 +813,17 @@ struct device_node *of_find_node_by_path
struct property *pp;
unsigned long flags;
+ if (strcmp(path, "/") == 0) {
+ raw_spin_lock_irqsave(&devtree_lock, flags);
+ for (; np; np = np->allnext) {
+ if (np->full_name && (of_node_cmp(np->full_name, path) == 0)
+ && of_node_get(np))
+ break;
+ }
+ raw_spin_unlock_irqrestore(&devtree_lock, flags);
+ return np;
+ }
+
/* The path could begin with an alias */
if (*path != '/') {
char *p = strchrnul(path, '/');
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists