From 6a1a7bf4550dfa7c639a906e658d1c00632660f9 Mon Sep 17 00:00:00 2001 From: Masayuki Ishikawa Date: Tue, 22 Feb 2022 17:33:14 +0900 Subject: [PATCH] Revert "pm: remove unnecessary depends on OSINIT_OS_READY" This reverts commit 8785673a7048d83d49327bbc1c9a6a17e6a8b27c. --- drivers/power/pm_register.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/power/pm_register.c b/drivers/power/pm_register.c index fa95b8efa3..3c68f31b2f 100644 --- a/drivers/power/pm_register.c +++ b/drivers/power/pm_register.c @@ -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;