Skip to content

Commit 19cb44b

Browse files
pabigotcarlescufi
authored andcommitted
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 <[email protected]>
1 parent 187697c commit 19cb44b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/idle.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ void idle(void *p1, void *unused2, void *unused3)
189189
* API we need to honor...
190190
*/
191191
z_set_timeout_expiry((ticks < IDLE_THRESH) ? 1 : ticks, true);
192-
#endif /* CONFIG_SYS_CLOCK_EXISTS */
193192
#ifdef CONFIG_PM
194193
_kernel.idle = ticks;
195194
/* Check power policy and decide if we are going to sleep or
@@ -198,9 +197,12 @@ void idle(void *p1, void *unused2, void *unused3)
198197
if (pm_save_idle(ticks) == POWER_STATE_ACTIVE) {
199198
k_cpu_idle();
200199
}
201-
#else
200+
#else /* CONFIG_PM */
202201
k_cpu_idle();
203202
#endif /* CONFIG_PM */
203+
#else /* CONFIG_SYS_CLOCK_EXISTS */
204+
k_cpu_idle();
205+
#endif /* CONFIG_SYS_CLOCK_EXISTS */
204206

205207
IDLE_YIELD_IF_COOP();
206208
#endif /* SMP_FALLBACK */

0 commit comments

Comments
 (0)