[01/10] pmdomain: core: fix "sd_count" field setting

Message ID 20240903153157.918185-1-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [01/10] pmdomain: core: fix "sd_count" field setting
Related show

Commit Message

Dario Binacchi Sept. 3, 2024, 3:31 p.m. UTC
The "sd_count" field keeps track of the number of subdomains with power
"on," so if pm_genpd_init() is called with the "is_off" parameter set to
false, it means that the power domain is already on, and therefore its
"sd_count" must be 1.

Co-Developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 drivers/pmdomain/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 623d15b68707..ea56e65d0b93 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -2111,7 +2111,7 @@  int pm_genpd_init(struct generic_pm_domain *genpd,
 	genpd_lock_init(genpd);
 	genpd->gov = gov;
 	INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
-	atomic_set(&genpd->sd_count, 0);
+	atomic_set(&genpd->sd_count, is_off ? 0 : 1);
 	genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
 	genpd->device_count = 0;
 	genpd->provider = NULL;