power: Relocate resuming device_notify() properly 06/289606/1
authorYoungjae Cho <y0.cho@samsung.com>
Fri, 10 Mar 2023 01:53:52 +0000 (10:53 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Fri, 10 Mar 2023 07:52:18 +0000 (16:52 +0900)
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 <y0.cho@samsung.com>
src/power/power-suspend.c
src/power/power.c

index efd6ccd..aff5611 100644 (file)
@@ -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)
index 866386b..f6f05e9 100644 (file)
@@ -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)