From f232db463078ff3e8a85ceeb9e9fcc0c14e141e3 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Tue, 14 Jun 2022 00:15:49 -0700 Subject: [PATCH] pm: Avoid unnecessary check in SMP _current_cpu is a macro that expands to an assert that checks if the current context can be migrated to a another cpu. Since this pm_system_suspend() is called from the idle thread (each cpu has its own) and with locked this check is redundant. Just use arch_curr_cpu() to avoid it. Signed-off-by: Flavio Ceolin --- subsys/pm/pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/pm/pm.c b/subsys/pm/pm.c index a8f8aa876aa..5c3537f4f23 100644 --- a/subsys/pm/pm.c +++ b/subsys/pm/pm.c @@ -201,7 +201,7 @@ bool pm_state_force(uint8_t cpu, const struct pm_state_info *info) bool pm_system_suspend(int32_t ticks) { - uint8_t id = _current_cpu->id; + uint8_t id = CURRENT_CPU; k_spinlock_key_t key; SYS_PORT_TRACING_FUNC_ENTER(pm, system_suspend, ticks);