From 8f54f9e1c3e2830008c9ba485e373821d0b29a45 Mon Sep 17 00:00:00 2001 From: ligd Date: Mon, 20 Jun 2022 00:02:42 +0800 Subject: [PATCH] sim: idle pm should do PM_RESOTRE in critical section Signed-off-by: ligd --- arch/sim/src/sim/up_idle.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/sim/src/sim/up_idle.c b/arch/sim/src/sim/up_idle.c index 7e4a4d6208840..71b764df560c3 100644 --- a/arch/sim/src/sim/up_idle.c +++ b/arch/sim/src/sim/up_idle.c @@ -59,9 +59,13 @@ void up_idle(void) #ifdef CONFIG_PM static enum pm_state_e state = PM_NORMAL; enum pm_state_e newstate; + irqstate_t flags; /* Fake some power management stuff for testing purposes */ + flags = enter_critical_section(); + sched_lock(); + newstate = pm_checkstate(PM_IDLE_DOMAIN); if (newstate != state) { @@ -78,4 +82,11 @@ void up_idle(void) up_timer_update(); #endif + +#ifdef CONFIG_PM + pm_changestate(PM_IDLE_DOMAIN, PM_RESTORE); + + sched_unlock(); + leave_critical_section(flags); +#endif }