Thread (1 message) 1 message, 1 author, 2017-01-23

Re: [PATCH] of/platform: Ignore disabled devices in of_platform_populate()

From: Alexander Sverdlin <hidden>
Date: 2017-01-23 12:24:20

Hello all,

On 23/01/17 13:21, Alexander Sverdlin wrote:
quoted hunk
Check the status property and give up early enough. Otherwise
OF_POPULATED_BUS might be set for disabled bus which will prevent
it from being populated later (if enabled).

Signed-off-by: Alexander Sverdlin <redacted>
Cc: Rob Herring <redacted>
Cc: Frank Rowand <redacted>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---
 drivers/of/platform.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 35de1fc59fa6..5ad8c13f754a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -473,9 +473,13 @@ int of_platform_populate(struct device_node *root,
 	struct device_node *child;
 	int rc = 0;
 
-	root = root ? of_node_get(root) : of_find_node_by_path("/");
+	if (!root)
+		root = of_find_node_by_path("/");
 	if (!root)
 		return -EINVAL;
+	if (!of_device_is_available(root))
+		return 0;
+	of_node_get(root);
Auch, I see unbalanced reference counting here, please ignore this patch... 
 	pr_debug("%s()\n", __func__);
 	pr_debug(" starting at: %s\n", root->full_name);
-- 
Best regards,
Alexander Sverdlin.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help