Skip to content

Commit

Permalink
sim: idle pm should do PM_RESOTRE in critical section
Browse files Browse the repository at this point in the history
Signed-off-by: ligd <liguiding1@xiaomi.com>
  • Loading branch information
GUIDINGLI authored and pkarashchenko committed Jul 22, 2022
1 parent 008cb0d commit 8f54f9e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/sim/src/sim/up_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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
}

0 comments on commit 8f54f9e

Please sign in to comment.