pm: Error with handling z_cpus_active count
z_cpus_active count becomes incorrect when the state is PM_STATE_RUNTIME_IDLE and CONFIG_PM_DEVICE is enabled. Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
This commit is contained in:
parent
5dd50f9232
commit
ae97eae8c2
1 changed files with 10 additions and 9 deletions
|
@ -242,15 +242,16 @@ bool pm_system_suspend(int32_t ticks)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_PM_DEVICE) && !defined(CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE)
|
#if defined(CONFIG_PM_DEVICE) && !defined(CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE)
|
||||||
if ((z_cpus_pm_state[id].state != PM_STATE_RUNTIME_IDLE) &&
|
if (atomic_sub(&z_cpus_active, 1) == 1) {
|
||||||
(atomic_sub(&z_cpus_active, 1) == 1)) {
|
if (z_cpus_pm_state[id].state != PM_STATE_RUNTIME_IDLE) {
|
||||||
if (pm_suspend_devices()) {
|
if (pm_suspend_devices()) {
|
||||||
pm_resume_devices();
|
pm_resume_devices();
|
||||||
z_cpus_pm_state[id].state = PM_STATE_ACTIVE;
|
z_cpus_pm_state[id].state = PM_STATE_ACTIVE;
|
||||||
(void)atomic_add(&z_cpus_active, 1);
|
(void)atomic_add(&z_cpus_active, 1);
|
||||||
SYS_PORT_TRACING_FUNC_EXIT(pm, system_suspend, ticks,
|
SYS_PORT_TRACING_FUNC_EXIT(pm, system_suspend, ticks,
|
||||||
z_cpus_pm_state[id].state);
|
z_cpus_pm_state[id].state);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue