timekeeping: Simplify timekeeping_clocktai()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 16 Jul 2014 21:05:01 +0000 (21:05 +0000)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 23 Jul 2014 22:01:48 +0000 (15:01 -0700)
timekeeping_clocktai() is not used in fast pathes, so the extra
timespec conversion is not problematic.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
include/linux/timekeeping.h
kernel/time/timekeeping.c

index 7b8f200078715d5c1f5c2c33329cf40d922d9709..f0f12a84a31b02e7f74dc35092917d4b4c767ec8 100644 (file)
@@ -166,6 +166,11 @@ static inline void get_monotonic_boottime(struct timespec *ts)
        *ts = ktime_to_timespec(ktime_get_boottime());
 }
 
+static inline void timekeeping_clocktai(struct timespec *ts)
+{
+       *ts = ktime_to_timespec(ktime_get_clocktai());
+}
+
 /*
  * RTC specific
  */
index 50d5de05b8374475ae710bd41cf53430999a8126..118e91e3071c29e3e427cfd0ef410e9320f39134 100644 (file)
@@ -497,37 +497,6 @@ void ktime_get_ts64(struct timespec64 *ts)
 }
 EXPORT_SYMBOL_GPL(ktime_get_ts64);
 
-
-/**
- * timekeeping_clocktai - Returns the TAI time of day in a timespec
- * @ts:                pointer to the timespec to be set
- *
- * Returns the time of day in a timespec.
- */
-void timekeeping_clocktai(struct timespec *ts)
-{
-       struct timekeeper *tk = &tk_core.timekeeper;
-       struct timespec64 ts64;
-       unsigned long seq;
-       u64 nsecs;
-
-       WARN_ON(timekeeping_suspended);
-
-       do {
-               seq = read_seqcount_begin(&tk_core.seq);
-
-               ts64.tv_sec = tk->xtime_sec + tk->tai_offset;
-               nsecs = timekeeping_get_ns(tk);
-
-       } while (read_seqcount_retry(&tk_core.seq, seq));
-
-       ts64.tv_nsec = 0;
-       timespec64_add_ns(&ts64, nsecs);
-       *ts = timespec64_to_timespec(ts64);
-
-}
-EXPORT_SYMBOL(timekeeping_clocktai);
-
 #ifdef CONFIG_NTP_PPS
 
 /**