mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] of: refuse to delete root node of live tree
@ 2021-06-25 14:02 Sascha Hauer
  2021-06-25 14:02 ` [PATCH 2/2] of: Fix deep-probe triggering when removing nodes Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2021-06-25 14:02 UTC (permalink / raw)
  To: Barebox List

The root node of the live tree should never be deleted, so refuse to do
so and print an error message. Deleting the live tree was possible with
the oftree -f command which was removed in c39c70bac5 ("commands: oftree:
kill oftree -f"). As this no longer exists we also do not need the
of_set_root_node(NULL) part anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5756f8b60a..551b41fc9e 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2441,6 +2441,11 @@ void of_delete_node(struct device_node *node)
 	if (!node)
 		return;
 
+	if (node == root_node) {
+		pr_err("Won't delete root device node\n");
+		return;
+	}
+
 	list_for_each_entry_safe(p, pt, &node->properties, list)
 		of_delete_property(p);
 
@@ -2459,9 +2464,6 @@ void of_delete_node(struct device_node *node)
 	free(node->name);
 	free(node->full_name);
 	free(node);
-
-	if (node == root_node)
-		of_set_root_node(NULL);
 }
 
 struct device_node *of_get_stdoutpath(void)
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] of: Fix deep-probe triggering when removing nodes
  2021-06-25 14:02 [PATCH 1/2] of: refuse to delete root node of live tree Sascha Hauer
@ 2021-06-25 14:02 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-06-25 14:02 UTC (permalink / raw)
  To: Barebox List

During deletion of device nodes of_find_device_by_node() is called in
order to set the device_node pointer of the device corresponding to
the to-be-deleted node to NULL. This is not necessary anymore as the
live tree should not be deleted.
This fixes problems with deep-probe support. of_find_device_by_node()
calls of_device_ensure_probed(), but this may only be called on the
live tree, not on arbitrary nodes that shall be deleted.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/base.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 551b41fc9e..9a8fdc81e8 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2436,7 +2436,6 @@ void of_delete_node(struct device_node *node)
 {
 	struct device_node *n, *nt;
 	struct property *p, *pt;
-	struct device_d *dev;
 
 	if (!node)
 		return;
@@ -2457,10 +2456,6 @@ void of_delete_node(struct device_node *node)
 		list_del(&node->list);
 	}
 
-	dev = of_find_device_by_node(node);
-	if (dev)
-		dev->device_node = NULL;
-
 	free(node->name);
 	free(node->full_name);
 	free(node);
-- 
2.30.2


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-25 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 14:02 [PATCH 1/2] of: refuse to delete root node of live tree Sascha Hauer
2021-06-25 14:02 ` [PATCH 2/2] of: Fix deep-probe triggering when removing nodes Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox