Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions os/pm/pm_resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ int pm_resume(int domain_id)
if (ret != OK) {
goto errout;
}
if (g_pmglobals.suspend_count[domain_id] <= 0) {
ret = ERROR;
set_errno(ERANGE);
goto errout;
if (g_pmglobals.suspend_count[domain_id]) {
g_pmglobals.suspend_count[domain_id] = false;
} else {
pmdbg("Thread with pid (%d) tried to resume domain (%s) again\n", getpid(), pm_domain_map[domain_id]);
}
#ifdef CONFIG_PM_METRICS
pm_metrics_update_resume(domain_id);
#endif
g_pmglobals.suspend_count[domain_id]--;
errout:
leave_critical_section(flags);
return ret;
Expand Down
9 changes: 4 additions & 5 deletions os/pm/pm_suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,14 @@ int pm_suspend(int domain_id)
if (ret != OK) {
goto errout;
}
if (g_pmglobals.suspend_count[domain_id] >= UINT16_MAX) {
ret = ERROR;
set_errno(ERANGE);
goto errout;
if (g_pmglobals.suspend_count[domain_id]) {
pmdbg("Thread with pid (%d) tried to suspend domain (%s) again\n", getpid(), pm_domain_map[domain_id]);
} else {
g_pmglobals.suspend_count[domain_id] = true;
}
#ifdef CONFIG_PM_METRICS
pm_metrics_update_suspend(domain_id);
#endif
g_pmglobals.suspend_count[domain_id]++;
errout:
leave_critical_section(flags);
return ret;
Expand Down