1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #18842 from kfessel/p-pm-layerd-speedup

sys/pm_layered: move (un)block assert for minor speedup
This commit is contained in:
benpicco 2022-11-04 02:36:57 +01:00 committed by GitHub
commit f954a8bac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}