diff options
author | Colin Cross <ccross@android.com> | 2011-03-30 12:37:49 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:53 -0700 |
commit | 28e23cf73c26d2bb13451804e328797a55f471e4 (patch) | |
tree | 06b4e77dabde6ac914133a48303ddcfaf47fcdb6 /kernel/power | |
parent | e67dd1611d5330ba9d41ba9ccdc78d6ff2963398 (diff) | |
download | kernel_samsung_tuna-28e23cf73c26d2bb13451804e328797a55f471e4.zip kernel_samsung_tuna-28e23cf73c26d2bb13451804e328797a55f471e4.tar.gz kernel_samsung_tuna-28e23cf73c26d2bb13451804e328797a55f471e4.tar.bz2 |
power: wakelock: use get_xtime_and_monotonic_and_sleep_offset in get_expired_time
Change-Id: I6ebe6b954b2ff328d46898d683650dafb9c4fe74
Signed-off-by: Erik Gilling <konkers@android.com>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/wakelock.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index ee9781c..c10d0ee 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -60,19 +60,15 @@ int get_expired_time(struct wake_lock *lock, ktime_t *expire_time) struct timespec kt; struct timespec tomono; struct timespec delta; - unsigned long seq; + struct timespec sleep; long timeout; if (!(lock->flags & WAKE_LOCK_AUTO_EXPIRE)) return 0; - do { - seq = read_seqbegin(&xtime_lock); - timeout = lock->expires - jiffies; - if (timeout > 0) - return 0; - kt = current_kernel_time(); - tomono = __get_wall_to_monotonic(); - } while (read_seqretry(&xtime_lock, seq)); + get_xtime_and_monotonic_and_sleep_offset(&kt, &tomono, &sleep); + timeout = lock->expires - jiffies; + if (timeout > 0) + return 0; jiffies_to_timespec(-timeout, &delta); set_normalized_timespec(&ts, kt.tv_sec + tomono.tv_sec - delta.tv_sec, kt.tv_nsec + tomono.tv_nsec - delta.tv_nsec); |