diff --git a/drivers/power/pm_governor.c b/drivers/power/pm_governor.c index 04adc8f677..cf58798072 100644 --- a/drivers/power/pm_governor.c +++ b/drivers/power/pm_governor.c @@ -70,11 +70,6 @@ int pm_set_governor(int domain, FAR const struct pm_governor_s *gov) { -#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX - int state; - int dom; -#endif - if (gov == NULL) { return -EINVAL; @@ -93,19 +88,5 @@ int pm_set_governor(int domain, FAR const struct pm_governor_s *gov) g_pmglobals.domain[domain].governor->initialize(); } -#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX - for (dom = 0; dom < CONFIG_PM_NDOMAINS; dom++) - { - for (state = 0; state < PM_COUNT; state++) - { -#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX < 0 - pm_stay(dom, state); -#else - pm_staytimeout(dom, state, CONFIG_PM_GOVERNOR_EXPLICIT_RELAX); -#endif - } - } -#endif - return 0; } diff --git a/drivers/power/pm_initialize.c b/drivers/power/pm_initialize.c index 839cec0bbf..693f3ebb64 100644 --- a/drivers/power/pm_initialize.c +++ b/drivers/power/pm_initialize.c @@ -74,6 +74,9 @@ struct pm_global_s g_pmglobals = void pm_initialize(void) { FAR const struct pm_governor_s *gov; +#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX + int state; +#endif int i; pm_wakelock_global_init(); @@ -93,6 +96,17 @@ void pm_initialize(void) pm_set_governor(i, gov); nxrmutex_init(&g_pmglobals.domain[i].lock); + +#if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX + for (state = 0; state < PM_COUNT; state++) + { +# if CONFIG_PM_GOVERNOR_EXPLICIT_RELAX < 0 + pm_stay(i, state); +# else + pm_staytimeout(i, state, CONFIG_PM_GOVERNOR_EXPLICIT_RELAX); +# endif + } +#endif } }