[PATCH] of: of_probe: create board's machine device at the earliest
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 5 00:02:08 PDT 2022
We currently create devices for matching reserved memory entries and
firmware before creating the machine device. In a deep probe system, the
machine driver would be probed directly at registration and as such
needs to be probed before other devices are created, so it can disable
other devices if needed. Move the machine device registration to the
top, so board drivers can disabled reserved memory entries and firmware
if they need to.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/of/base.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 52e6a9294e11..6a51dd71793d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -2503,6 +2503,12 @@ int of_probe(void)
if(!root_node)
return -ENODEV;
+ /*
+ * We do this first thing, so board drivers can patch the device
+ * tree prior to device creation if needed.
+ */
+ of_platform_device_create_root(root_node);
+
/*
* Handle certain compatibles explicitly, since we don't want to create
* platform_devices for every node in /reserved-memory with a
@@ -2515,8 +2521,6 @@ int of_probe(void)
if (node)
of_platform_populate(node, NULL, NULL);
- of_platform_device_create_root(root_node);
-
of_platform_populate(root_node, of_default_bus_match_table, NULL);
return 0;
--
2.30.2
More information about the barebox
mailing list