input: evdev: Use ktime_mono_to_real()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 16 Jul 2014 21:04:25 +0000 (21:04 +0000)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 23 Jul 2014 17:18:02 +0000 (10:18 -0700)
Convert the monotonic timestamp with ktime_mono_to_real() in
evdev_events().

In evdev_queue_syn_dropped() we can call either ktime_get() or
ktime_get_real() depending on the clkid. No point in having two calls
for CLOCK_REALTIME.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
drivers/input/evdev.c

index fd325ec9f064c95fafd532a7ef64e87ca88828d1..de055451d1af6e5beab07118eb38b6a90003c8a8 100644 (file)
@@ -108,9 +108,8 @@ static void evdev_queue_syn_dropped(struct evdev_client *client)
        struct input_event ev;
        ktime_t time;
 
-       time = ktime_get();
-       if (client->clkid != CLOCK_MONOTONIC)
-               time = ktime_sub(time, ktime_get_monotonic_offset());
+       time = (client->clkid == CLOCK_MONOTONIC) ?
+               ktime_get() : ktime_get_real();
 
        ev.time = ktime_to_timeval(time);
        ev.type = EV_SYN;
@@ -202,7 +201,7 @@ static void evdev_events(struct input_handle *handle,
        ktime_t time_mono, time_real;
 
        time_mono = ktime_get();
-       time_real = ktime_sub(time_mono, ktime_get_monotonic_offset());
+       time_real = ktime_mono_to_real(time_mono);
 
        rcu_read_lock();