For echo mem, there could be some pending transitions when it comes to
enter suspend. This is because transition is asynchronously processed.
That is, if there were another transition request during a sleep
transition, the sleep transition should be skipped and take the next
transition immediately. Otherwise, the next transition will handled
after wakeup, which is indefinite.
Change-Id: Ia09a1d1162e21710538f6e9ce7bd1fb3e9c43d0f
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
static void suspend_echo_mem(void)
{
+ if (is_there_pending_transition()) {
+ /**
+ * For echo mem, there could be some pending transitions at this point because
+ * transition is aynchronous. That is, if there were another transition request
+ * during a sleep transition, the sleep transition should be skipped and take
+ * the next transition immediately. Otherwise, the next transition will handled
+ * after wakeup, which is indefinite.
+ */
+ _D("Skip echo mem, trigger next transition immediately.");
+ return;
+ }
+
sys_set_str("/sys/power/state", "mem");
// resume
transition_context.ti.reason));
}
+int is_there_pending_transition(void)
+{
+ return (g_queue_peek_tail(transition_queue) != NULL);
+}
+
static uint64_t available_starting_state(void)
{
struct trans_info *ti = NULL;
uint64_t power_get_state(void);
int add_change_state_wait(pid_t pid, guint64 state);
+int is_there_pending_transition(void);
void remove_change_state_wait(pid_t pid, guint64 state);
int confirm_change_state_wait(pid_t pid, guint64 transition_id);
int cancel_change_state_wait(pid_t pid, guint64 transition_id);