power: wakelock: use get_xtime_and_monotonic_and_sleep_offset in get_expired_time
authorColin Cross <ccross@android.com>
Wed, 30 Mar 2011 19:37:49 +0000 (12:37 -0700)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:53 +0000 (09:09 -0700)
Change-Id: I6ebe6b954b2ff328d46898d683650dafb9c4fe74
Signed-off-by: Erik Gilling <konkers@android.com>
kernel/power/wakelock.c

index ee9781c5adb2835135ff0408b936cd64cc0c78b0..c10d0ee7907edfcd2d72736866a8f43ffc7bba69 100644 (file)
@@ -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);