Thread (11 messages) 11 messages, 2 authors, 2021-12-07
STALE1660d

[PATCH 3/7] of: overlay: rescan aliases calling of_overlay_apply_tree on live tree

From: Ahmad Fatoum <a.fatoum@pengutronix.de>
Date: 2021-11-25 16:12:49
Subsystem: open firmware and flattened device tree, the rest · Maintainers: Rob Herring, Saravana Kannan, Linus Torvalds

Couple of drivers in-tree, like state, depend on aliases for correct
operation. If state node is added via overlay and oftree -p is called,
driver would start probing, but fail because aliases weren't reloaded.

Fix this corner case by always just calling of_alias_scan() on every
successful of_overlay_apply_tree to the live tree. No functional change
yet, as the only user of this function is overlay application code of
ARM QEMU machine, which happens at pure_initcall level, making
of_alias_scan a no-op. Follow-up commit will move overlay application to
happen after device tree is registered, necessitating this change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/of/overlay.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index e6f6634d6042..20a43f5170c8 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -199,6 +199,10 @@ int of_overlay_apply_tree(struct device_node *root,
 			pr_warn("failed to apply %s\n", fragment->name);
 	}
 
+	/* We are patching the live tree, reload aliases */
+	if (root == of_get_root_node())
+		of_alias_scan();
+
 out_err:
 	of_delete_node(resolved);
 
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help