Skip to contentSkip to conversation

pmdomain: fix early domain registration

PATCH In review Johan Hovold 3 participants 4 messages Jun 9 – Jun 10 Generic PM domains

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pmdomain: 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 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.

---
 drivers/pmdomain/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pmdomain/core.c +2 -1
index 3f265b57158a..19eaee1819c8 100644
@@ -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)) {
Signature · 1 line
2.53.0
Tested-by on v1 1/1
#1 lore raw

Hi Johan,

Quoted 7 lines · Johan Hovold

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.

Thanks for your patch!

Quoted 3 lines

s/Link/Closes/

Quoted 1 line

This fixes the issue on R-Car H1, M2-W, H3 ES2.0, and on RZ/A1H. No regressions seen on SH-Mobile AG5, R-Mobile A1, and R-Car V4M.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#2 lore raw
Quoted 9 lines · Geert Uytterhoeven
Quoted 7 lines · Johan Hovold

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.

Quoted 7 lines

Thanks for your patch!

Quoted 3 lines

s/Link/Closes/

I use use Link: on purpose (like Linus does).

Quoted 6 lines
Quoted 1 line

This fixes the issue on R-Car H1, M2-W, H3 ES2.0, and on RZ/A1H. No regressions seen on SH-Mobile AG5, R-Mobile A1, and R-Car V4M.

Thanks for confirming.

Johan

#3 lore raw
In reply to Johan Hovold
Quoted 6 lines · Johan Hovold

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")).

Quoted 7 lines

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

Applied for next, thanks!

Kind regards
Uffe

Quoted 35 lines
---
 drivers/pmdomain/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pmdomain/core.c +2 -2
index 3f265b57158a..19eaee1819c8 100644
@@ -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)) {
--

2.53.0