[PATCH 6/8] of: Call of_add_memory from of_probe

Sascha Hauer s.hauer at pengutronix.de
Mon May 20 10:14:18 EDT 2013


memory is always in /mem, so call of_add_memory from of_probe once
instead of in the recursive tree iteration. This makes it possible
to limit the device population to nodes with the "simple-bus" property
set.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/of/base.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index ef97a15..c3395cf 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -923,10 +923,6 @@ static int add_of_device_resource(struct device_node *node)
 	int na, nc, n_resources;
 	int ret, len, index;
 
-	ret = of_add_memory(node, false);
-	if (ret != -ENXIO)
-		return ret;
-
 	reg = of_get_property(node, "reg", &len);
 	if (!reg)
 		return -EINVAL;
@@ -1070,6 +1066,8 @@ const char *of_get_model(void)
 
 int of_probe(void)
 {
+	struct device_node *memory;
+
 	if(!root_node)
 		return -ENODEV;
 
@@ -1079,6 +1077,10 @@ int of_probe(void)
 	__of_parse_phandles(root_node);
 	__of_probe(root_node);
 
+	memory = of_find_node_by_path(root_node, "/memory");
+	if (memory)
+		of_add_memory(memory, false);
+
 	return 0;
 }
 
-- 
1.8.2.rc2




More information about the barebox mailing list