From 065f075a23ebf1dc387df715dce9efe03b5cf5ba Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Fri, 10 Mar 2023 10:53:52 +0900 Subject: [PATCH] power: Relocate resuming device_notify() properly The resuming notify should be broadcasted after completely finishing wakeup transition. In other words, broadcasting should be held when a transition is waiting for being confirmed by user program. In this context, it is proper to relocate device_notify() to resume_echo_mem(), which is invoked on finishing wakeup transition. Change-Id: I0c924d5667b749f79e95f04b62c69e499ffb7058 Signed-off-by: Youngjae Cho --- src/power/power-suspend.c | 3 +-- src/power/power.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/power/power-suspend.c b/src/power/power-suspend.c index efd6ccd..aff5611 100644 --- a/src/power/power-suspend.c +++ b/src/power/power-suspend.c @@ -392,7 +392,6 @@ static void suspend_echo_mem(void) // resume update_wakeup_reason(); - device_notify(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, NULL); /* * FIXME: If the wakeup reason lingers after wakeup, a transition triggered from other * than the above line would take the lingering wakeup reason as a transition reason, @@ -408,7 +407,7 @@ static void suspend_echo_mem(void) static void resume_echo_mem(void) { - // nothing to do + device_notify(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, NULL); } static void suspend_autosleep(void) diff --git a/src/power/power.c b/src/power/power.c index 866386b..f6f05e9 100644 --- a/src/power/power.c +++ b/src/power/power.c @@ -295,7 +295,8 @@ static uint64_t alloc_unique_id(void) static void pre_action_normal(void *udata) { - power_resume(transition_context.ti.reason); + if (transition_context.ti.curr == DEVICED_POWER_STATE_SLEEP) + power_resume(transition_context.ti.reason); } static void post_action_sleep(void *udata) -- 2.7.4