Quoting Rob Herring (2024-05-15 15:08:47)
On Wed, May 15, 2024 at 4:15 PM Stephen Boyd sboyd@kernel.org wrote:
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 389d4ea6bfc1..acecefcfdba7 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -421,6 +421,7 @@ int of_platform_bus_probe(struct device_node *root, if (of_match_node(matches, root)) { rc = of_platform_bus_create(root, matches, NULL, parent, false); } else for_each_child_of_node(root, child) {
of_node_set_flag(root, OF_POPULATED_BUS);
No, the same spot as of_platform_populate has it. I guess this would be the same, but no reason to do this in the for_each_child_of_node loop...
Ok. I'm not intending to send this patch.
if (!of_match_node(matches, child)) continue; rc = of_platform_bus_create(child, matches, NULL, parent, false);
This doesn't work though. I see that prom_init() is called, which constructs a DTB and flattens it to be unflattened by unflatten_device_tree(). The powerpc machine type used by qemu is PLATFORM_PSERIES_LPAR. It looks like it never calls of_platform_bus_probe() from the pseries platform code.
Huh. Maybe pseries doesn't have any platform devices?
Looks like it.
Ideally, we'd still do it in of_platform_default_populate_init(), but if you look at the history, you'll see that broke some PPC boards (damn initcall ordering).
What about skipping the OF_POPULATED_BUS check, or skipping the check when the parent is the root node? This is the if condition that's giving the headache.
I don't think we should just remove it, but a root node check seems fine.
Alright. I've added a check to see if the root node is the parent to allow it. That works well enough, so I'll send that in v5.