pmdomain: core: fix early domain registration

A recent change switching to a dynamically allocated root device broke
platforms like rcar-sysc that registers PM domains before the PM domain
bus itself has been registered (cf. commit c5ae5a0c61 ("pmdomain:
renesas: rcar-sysc: Add genpd OF provider at postcore_initcall")).

Defer the assignment of the parent root device until the domain is
registered with driver core to avoid it being left unset.

Fixes: a96e40f4af ("pmdomain: core: switch to dynamic root device")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/CAMuHMdUHabMGJyJ7e7yp7DLC+JJc9k6NK9p4anj2wRKNuwZUng@mail.gmail.com
Signed-off-by: Johan Hovold <johan@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulfh@kernel.org>
This commit is contained in:
Johan Hovold
2026-06-09 18:06:34 +02:00
committed by Ulf Hansson
parent c2078a9855
commit 92b69eff80

View File

@@ -2323,7 +2323,6 @@ static int genpd_alloc_data(struct generic_pm_domain *genpd)
device_initialize(&genpd->dev);
genpd->dev.release = genpd_provider_release;
genpd->dev.bus = &genpd_provider_bus_type;
genpd->dev.parent = genpd_provider_bus;
if (!genpd_is_dev_name_fw(genpd)) {
dev_set_name(&genpd->dev, "%s", genpd->name);
@@ -2688,6 +2687,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
if (!genpd_present(genpd))
return -EINVAL;
genpd->dev.parent = genpd_provider_bus;
genpd->dev.of_node = np;
fwnode = of_fwnode_handle(np);
@@ -2782,6 +2782,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
if (!genpd_present(genpd))
goto error;
genpd->dev.parent = genpd_provider_bus;
genpd->dev.of_node = np;
if (sync_state && !genpd_is_no_sync_state(genpd)) {