mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 06:25:52 +02:00
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>
This commit is contained in:
parent
e67dd1611d
commit
28e23cf73c
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user