Skip to content

Commit

Permalink
arch: arm: cortex_m: fix inverted logic in cpu_idle
Browse files Browse the repository at this point in the history
This mistake was introduced when converting from ASM to C.
This change also restores the associated comment from the ASM source.

Signed-off-by: Wilfried Chauveau <[email protected]>
  • Loading branch information
ithinuel authored and aescolar committed Apr 17, 2024
1 parent 5dd1b96 commit fb6ab56
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/arm/core/cortex_m/cpu_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ void z_arm_cpu_idle_init(void)

#if defined(CONFIG_ARM_ON_ENTER_CPU_IDLE_HOOK)
#define SLEEP_IF_ALLOWED(wait_instr) do { \
if (!z_arm_on_enter_cpu_idle()) { \
/* Skip the wait instr if on_enter_cpu_idle returns false */ \
if (z_arm_on_enter_cpu_idle()) { \
/* Wait for all memory transaction to complete */ \
/* before entering low power state. */ \
__DSB(); \
wait_instr(); \
/* Inline the macro provided by SoC-specific code */ \
ON_EXIT_IDLE_HOOK; \
} \
} while (false)
Expand Down

0 comments on commit fb6ab56

Please sign in to comment.