From a3568af10551c37b839169634c33fbe78044725f Mon Sep 17 00:00:00 2001 From: ligd Date: Tue, 6 Aug 2024 21:29:25 +0800 Subject: [PATCH] sim: fix context-switch when do wdog callback() Signed-off-by: ligd --- arch/sim/src/sim/sim_idle.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/sim/src/sim/sim_idle.c b/arch/sim/src/sim/sim_idle.c index 547f454b8b..16e05d34b2 100644 --- a/arch/sim/src/sim/sim_idle.c +++ b/arch/sim/src/sim/sim_idle.c @@ -57,13 +57,15 @@ void up_idle(void) #ifdef CONFIG_PM static enum pm_state_e state = PM_NORMAL; enum pm_state_e newstate; +#endif irqstate_t flags; - /* Fake some power management stuff for testing purposes */ - flags = enter_critical_section(); sched_lock(); +#ifdef CONFIG_PM + /* Fake some power management stuff for testing purposes */ + newstate = pm_checkstate(PM_IDLE_DOMAIN); if (newstate != state) { @@ -83,8 +85,8 @@ void up_idle(void) #ifdef CONFIG_PM pm_changestate(PM_IDLE_DOMAIN, PM_RESTORE); +#endif sched_unlock(); leave_critical_section(flags); -#endif }