power: wakelock: use get_xtime_and_monotonic_and_sleep_offset in get_expired_time
[linux-2.6.git] / kernel / power / wakelock.c
index d3d7fd6..c10d0ee 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 = 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);