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

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Nov 25 08:10:38 PST 2021


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 at 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




More information about the barebox mailing list