power: don't wait for timeout if sys_sync completes early
In some cases the suspend thread is waiting for timer to expire even if the sync workqueue is empty. So the suspend is taking extra time. To avoid this waiting, sending the completion event from last sync item in workqueue. CRs-Fixed: 583016 Change-Id: Ia3219e90762ec7f6ad3e7096126832acfd03ed69 Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
parent
63d6049bf5
commit
aea8045d06
|
@ -265,6 +265,9 @@ long has_wake_lock(int type)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool is_suspend_sys_sync_waiting;
|
||||
static void suspend_sys_sync_handler(unsigned long);
|
||||
static DEFINE_TIMER(suspend_sys_sync_timer, suspend_sys_sync_handler, 0, 0);
|
||||
static void suspend_sys_sync(struct work_struct *work)
|
||||
{
|
||||
if (debug_mask & DEBUG_SUSPEND)
|
||||
|
@ -277,6 +280,10 @@ static void suspend_sys_sync(struct work_struct *work)
|
|||
|
||||
spin_lock(&suspend_sys_sync_lock);
|
||||
suspend_sys_sync_count--;
|
||||
if (is_suspend_sys_sync_waiting && (suspend_sys_sync_count == 0)) {
|
||||
complete(&suspend_sys_sync_comp);
|
||||
del_timer(&suspend_sys_sync_timer);
|
||||
}
|
||||
spin_unlock(&suspend_sys_sync_lock);
|
||||
}
|
||||
static DECLARE_WORK(suspend_sys_sync_work, suspend_sys_sync);
|
||||
|
@ -293,8 +300,6 @@ void suspend_sys_sync_queue(void)
|
|||
}
|
||||
|
||||
static bool suspend_sys_sync_abort;
|
||||
static void suspend_sys_sync_handler(unsigned long);
|
||||
static DEFINE_TIMER(suspend_sys_sync_timer, suspend_sys_sync_handler, 0, 0);
|
||||
/* value should be less then half of input event wake lock timeout value
|
||||
* which is currently set to 5*HZ (see drivers/input/evdev.c)
|
||||
*/
|
||||
|
@ -319,7 +324,9 @@ int suspend_sys_sync_wait(void)
|
|||
if (suspend_sys_sync_count != 0) {
|
||||
mod_timer(&suspend_sys_sync_timer, jiffies +
|
||||
SUSPEND_SYS_SYNC_TIMEOUT);
|
||||
is_suspend_sys_sync_waiting = true;
|
||||
wait_for_completion(&suspend_sys_sync_comp);
|
||||
is_suspend_sys_sync_waiting = false;
|
||||
}
|
||||
if (suspend_sys_sync_abort) {
|
||||
pr_info("suspend aborted....while waiting for sys_sync\n");
|
||||
|
|
Loading…
Reference in New Issue