mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jan Luebbe <jlu@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] of: simplify phandle lookup
Date: Mon, 14 Oct 2013 18:24:52 +0200	[thread overview]
Message-ID: <1381767893-13740-1-git-send-email-jlu@pengutronix.de> (raw)

From: Sascha Hauer <s.hauer@pengutronix.de>

Instead of populating an extra list containing all phandles just iterate
over the whole tree. This is done as preparation for more dynamic devicetrees
where parts are loaded at runtime. Here we don't want to keep the list of
phandles in sync.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 11 +++--------
 include/of.h      |  1 -
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 116dd0c..ba929bc 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -67,8 +67,6 @@ struct alias_prop {
 
 static LIST_HEAD(aliases_lookup);
 
-static LIST_HEAD(phandle_list);
-
 struct device_node *root_node;
 
 struct device_node *of_aliases;
@@ -274,9 +272,10 @@ struct device_node *of_find_node_by_phandle(phandle phandle)
 {
 	struct device_node *node;
 
-	list_for_each_entry(node, &phandle_list, phandles)
+	of_tree_for_each_node_from(node, root_node)
 		if (node->phandle == phandle)
 			return node;
+
 	return NULL;
 }
 EXPORT_SYMBOL(of_find_node_by_phandle);
@@ -1719,7 +1718,7 @@ const struct of_device_id of_default_bus_match_table[] = {
 
 int of_probe(void)
 {
-	struct device_node *memory, *node;
+	struct device_node *memory;
 
 	if(!root_node)
 		return -ENODEV;
@@ -1730,10 +1729,6 @@ int of_probe(void)
 	if (of_model)
 		barebox_set_model(of_model);
 
-	of_tree_for_each_node_from(node, root_node)
-		if (node->phandle)
-			list_add_tail(&node->phandles, &phandle_list);
-
 	memory = of_find_node_by_path("/memory");
 	if (memory)
 		of_add_memory(memory, false);
diff --git a/include/of.h b/include/of.h
index e5cd750..3381e69 100644
--- a/include/of.h
+++ b/include/of.h
@@ -30,7 +30,6 @@ struct device_node {
 	struct list_head children;
 	struct list_head parent_list;
 	struct list_head list;
-	struct list_head phandles;
 	phandle phandle;
 };
 
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2013-10-14 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-14 16:24 Jan Luebbe [this message]
2013-10-14 16:24 ` [PATCH 2/2] of: implement overlay support Jan Luebbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381767893-13740-1-git-send-email-jlu@pengutronix.de \
    --to=jlu@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox