]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ntp/pps: replace getnstime_raw_and_real with 64-bit version
authorArnd Bergmann <arnd@arndb.de>
Mon, 28 Sep 2015 20:21:29 +0000 (22:21 +0200)
committerJohn Stultz <john.stultz@linaro.org>
Thu, 1 Oct 2015 16:59:01 +0000 (09:59 -0700)
There is exactly one caller of getnstime_raw_and_real in the kernel,
which is the pps_get_ts function. This changes the caller and
the implementation to work on timespec64 types rather than timespec,
to avoid the time_t overflow on 32-bit architectures.

For consistency with the other new functions (ktime_get_seconds,
ktime_get_real_*, ...), I'm renaming the function to
ktime_get_raw_and_real_ts64.

We still need to convert from the internal 64-bit type to 32 bit
types in the caller, but this conversion is now pushed out from
getnstime_raw_and_real to pps_get_ts. A follow-up patch changes
the remaining pps code to completely avoid the conversion.

Acked-by: Richard Cochran <richardcochran@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
include/linux/pps_kernel.h
include/linux/timekeeping.h
kernel/time/timekeeping.c

index 1d2cd21242e8a75c1ac6aeb191d9964d2f3388ea..b2fbd62ab18d8b6bab5cb403765283478284646a 100644 (file)
@@ -115,7 +115,12 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
 
 static inline void pps_get_ts(struct pps_event_time *ts)
 {
-       getnstime_raw_and_real(&ts->ts_raw, &ts->ts_real);
+       struct timespec64 raw, real;
+
+       ktime_get_raw_and_real_ts64(&raw, &real);
+
+       ts->ts_raw = timespec64_to_timespec(raw);
+       ts->ts_real = timespec64_to_timespec(real);
 }
 
 #else /* CONFIG_NTP_PPS */
index ba0ae09cbb21f2038c71104a435f6782f70c1668..ec89d846324cac714807f7c002339636c497e4d8 100644 (file)
@@ -263,8 +263,8 @@ extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);
 /*
  * PPS accessor
  */
-extern void getnstime_raw_and_real(struct timespec *ts_raw,
-                                  struct timespec *ts_real);
+extern void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw,
+                                       struct timespec64 *ts_real);
 
 /*
  * Persistent clock related interfaces
index 177188b11a2efe6772d90b510be831d3dd351377..274ed5e88456b6543225dfef097e18810cee194d 100644 (file)
@@ -849,7 +849,7 @@ EXPORT_SYMBOL_GPL(ktime_get_real_seconds);
 #ifdef CONFIG_NTP_PPS
 
 /**
- * getnstime_raw_and_real - get day and raw monotonic time in timespec format
+ * ktime_get_raw_and_real_ts64 - get day and raw monotonic time in timespec format
  * @ts_raw:    pointer to the timespec to be set to raw monotonic time
  * @ts_real:   pointer to the timespec to be set to the time of day
  *
@@ -857,7 +857,7 @@ EXPORT_SYMBOL_GPL(ktime_get_real_seconds);
  * same time atomically and stores the resulting timestamps in timespec
  * format.
  */
-void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real)
+void ktime_get_raw_and_real_ts64(struct timespec64 *ts_raw, struct timespec64 *ts_real)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
        unsigned long seq;
@@ -868,7 +868,7 @@ void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real)
        do {
                seq = read_seqcount_begin(&tk_core.seq);
 
-               *ts_raw = timespec64_to_timespec(tk->raw_time);
+               *ts_raw = tk->raw_time;
                ts_real->tv_sec = tk->xtime_sec;
                ts_real->tv_nsec = 0;
 
@@ -877,10 +877,10 @@ void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real)
 
        } while (read_seqcount_retry(&tk_core.seq, seq));
 
-       timespec_add_ns(ts_raw, nsecs_raw);
-       timespec_add_ns(ts_real, nsecs_real);
+       timespec64_add_ns(ts_raw, nsecs_raw);
+       timespec64_add_ns(ts_real, nsecs_real);
 }
-EXPORT_SYMBOL(getnstime_raw_and_real);
+EXPORT_SYMBOL(ktime_get_raw_and_real_ts64);
 
 #endif /* CONFIG_NTP_PPS */