Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] os/pm: Change pm_suspend and pm_resume API logic #6487

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
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