Revert "pm: remove unnecessary depends on OSINIT_OS_READY"

This reverts commit 8785673a70.
This commit is contained in:
Masayuki Ishikawa 2022-02-22 17:33:14 +09:00 committed by Petro Karashchenko
parent fccdcf7011
commit 6a1a7bf455
1 changed files with 11 additions and 3 deletions

View File

@ -62,11 +62,19 @@ int pm_register(FAR struct pm_callback_s *callbacks)
/* Add the new entry to the end of the list of registered callbacks */
ret = pm_lock();
if (ret == OK)
if (OSINIT_OS_READY())
{
ret = pm_lock();
if (ret == OK)
{
dq_addlast(&callbacks->entry, &g_pmglobals.registry);
pm_unlock();
}
}
else
{
dq_addlast(&callbacks->entry, &g_pmglobals.registry);
pm_unlock();
ret = OK;
}
return ret;