@@ -187,6 +187,7 @@ static const struct genpd_lock_ops genpd_raw_spin_ops = {
187187#define genpd_is_opp_table_fw (genpd ) (genpd->flags & GENPD_FLAG_OPP_TABLE_FW)
188188#define genpd_is_dev_name_fw (genpd ) (genpd->flags & GENPD_FLAG_DEV_NAME_FW)
189189#define genpd_is_no_sync_state (genpd ) (genpd->flags & GENPD_FLAG_NO_SYNC_STATE)
190+ #define genpd_is_no_stay_on (genpd ) (genpd->flags & GENPD_FLAG_NO_STAY_ON)
190191
191192static inline bool irq_safe_dev_in_sleep_domain (struct device * dev ,
192193 const struct generic_pm_domain * genpd )
@@ -1357,7 +1358,6 @@ static int genpd_runtime_resume(struct device *dev)
13571358 return ret ;
13581359}
13591360
1360- #ifndef CONFIG_PM_GENERIC_DOMAINS_OF
13611361static bool pd_ignore_unused ;
13621362static int __init pd_ignore_unused_setup (char * __unused )
13631363{
@@ -1382,9 +1382,6 @@ static int __init genpd_power_off_unused(void)
13821382 mutex_lock (& gpd_list_lock );
13831383
13841384 list_for_each_entry (genpd , & gpd_list , gpd_list_node ) {
1385- genpd_lock (genpd );
1386- genpd -> stay_on = false;
1387- genpd_unlock (genpd );
13881385 genpd_queue_power_off_work (genpd );
13891386 }
13901387
@@ -1393,7 +1390,6 @@ static int __init genpd_power_off_unused(void)
13931390 return 0 ;
13941391}
13951392late_initcall_sync (genpd_power_off_unused );
1396- #endif
13971393
13981394#ifdef CONFIG_PM_SLEEP
13991395
@@ -2367,6 +2363,18 @@ static void genpd_lock_init(struct generic_pm_domain *genpd)
23672363 }
23682364}
23692365
2366+ #ifdef CONFIG_PM_GENERIC_DOMAINS_OF
2367+ static void genpd_set_stay_on (struct generic_pm_domain * genpd , bool is_off )
2368+ {
2369+ genpd -> stay_on = !genpd_is_no_stay_on (genpd ) && !is_off ;
2370+ }
2371+ #else
2372+ static void genpd_set_stay_on (struct generic_pm_domain * genpd , bool is_off )
2373+ {
2374+ genpd -> stay_on = false;
2375+ }
2376+ #endif
2377+
23702378/**
23712379 * pm_genpd_init - Initialize a generic I/O PM domain object.
23722380 * @genpd: PM domain object to initialize.
@@ -2392,7 +2400,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
23922400 INIT_WORK (& genpd -> power_off_work , genpd_power_off_work_fn );
23932401 atomic_set (& genpd -> sd_count , 0 );
23942402 genpd -> status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON ;
2395- genpd -> stay_on = ! is_off ;
2403+ genpd_set_stay_on ( genpd , is_off ) ;
23962404 genpd -> sync_state = GENPD_SYNC_STATE_OFF ;
23972405 genpd -> device_count = 0 ;
23982406 genpd -> provider = NULL ;
0 commit comments