]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
pmdomain: core: fix early domain registration
authorJohan Hovold <johan@kernel.org>
Tue, 9 Jun 2026 16:06:34 +0000 (18:06 +0200)
committerUlf Hansson <ulfh@kernel.org>
Thu, 11 Jun 2026 14:05:45 +0000 (16:05 +0200)
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 c5ae5a0c6112 ("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: a96e40f4afdc ("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>
drivers/pmdomain/core.c

index 7c96e88302d3959a44105185562ee9560ce4c6e3..7796042e3f373c8f8ffed273c34537218acd15b0 100644 (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)) {