kernel: idle: fix builds with PM but no system clock

PM depends on SYS_CLOCK_EXISTS in Kconfig but several boards have
Kconfig overrides that allow the dependency to be ignored, so
CONFIG_PM=y even though CONFIG_SYS_CLOCK_EXISTS=n.  Fix the code so
that the true dependency is reflected in the generated code.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
This commit is contained in:
Peter Bigot 2020-12-21 07:01:45 -06:00 committed by Carles Cufí
commit 19cb44bab7

View file

@ -189,7 +189,6 @@ void idle(void *p1, void *unused2, void *unused3)
* API we need to honor... * API we need to honor...
*/ */
z_set_timeout_expiry((ticks < IDLE_THRESH) ? 1 : ticks, true); z_set_timeout_expiry((ticks < IDLE_THRESH) ? 1 : ticks, true);
#endif /* CONFIG_SYS_CLOCK_EXISTS */
#ifdef CONFIG_PM #ifdef CONFIG_PM
_kernel.idle = ticks; _kernel.idle = ticks;
/* Check power policy and decide if we are going to sleep or /* Check power policy and decide if we are going to sleep or
@ -198,9 +197,12 @@ void idle(void *p1, void *unused2, void *unused3)
if (pm_save_idle(ticks) == POWER_STATE_ACTIVE) { if (pm_save_idle(ticks) == POWER_STATE_ACTIVE) {
k_cpu_idle(); k_cpu_idle();
} }
#else #else /* CONFIG_PM */
k_cpu_idle(); k_cpu_idle();
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#else /* CONFIG_SYS_CLOCK_EXISTS */
k_cpu_idle();
#endif /* CONFIG_SYS_CLOCK_EXISTS */
IDLE_YIELD_IF_COOP(); IDLE_YIELD_IF_COOP();
#endif /* SMP_FALLBACK */ #endif /* SMP_FALLBACK */