Skip to content

Commit

Permalink
Merge pull request #18842 from kfessel/p-pm-layerd-speedup
Browse files Browse the repository at this point in the history
sys/pm_layered: move (un)block assert for minor speedup
  • Loading branch information
benpicco authored Nov 4, 2022
2 parents 0284aa5 + f3ed268 commit f954a8b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions sys/pm_layered/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,20 @@ void pm_set_lowest(void)

void pm_block(unsigned mode)
{
assert(pm_blocker.blockers[mode] != 255);

DEBUG("[pm_layered] pm_block(%d)\n", mode);

unsigned state = irq_disable();
assert(pm_blocker.blockers[mode] != 255);
pm_blocker.blockers[mode]++;
irq_restore(state);
}

void pm_unblock(unsigned mode)
{
assert(pm_blocker.blockers[mode] > 0);

DEBUG("[pm_layered] pm_unblock(%d)\n", mode);

unsigned state = irq_disable();
assert(pm_blocker.blockers[mode] > 0);
pm_blocker.blockers[mode]--;
irq_restore(state);
}
Expand Down

0 comments on commit f954a8b

Please sign in to comment.