timekeeping: Clean up ktime_get_real_ts64
authorArnd Bergmann <arnd@arndb.de>
Fri, 27 Apr 2018 13:40:13 +0000 (15:40 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Sat, 19 May 2018 11:57:32 +0000 (13:57 +0200)
In a move to make ktime_get_*() the preferred driver interface into the
timekeeping code, sanitizes ktime_get_real_ts64() to be a proper exported
symbol rather than an alias for getnstimeofday64().

The internal __getnstimeofday64() is no longer used, so remove that
and merge it into ktime_get_real_ts64().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: y2038@lists.linaro.org
Cc: John Stultz <john.stultz@linaro.org>
Link: https://lkml.kernel.org/r/20180427134016.2525989-3-arnd@arndb.de
include/linux/timekeeping.h
include/linux/timekeeping32.h
kernel/time/timekeeping.c

index 588a0e4b1ab9336674b2bbc4f1fd0465b4d4a845..415dae6bf1f57ef7e6254b1f7aff8193cf3384f7 100644 (file)
@@ -30,15 +30,13 @@ struct timespec64 current_kernel_time64(void);
 struct timespec64 get_monotonic_coarse64(void);
 extern void getrawmonotonic64(struct timespec64 *ts);
 extern void ktime_get_ts64(struct timespec64 *ts);
+extern void ktime_get_real_ts64(struct timespec64 *tv);
 extern time64_t ktime_get_seconds(void);
 extern time64_t __ktime_get_real_seconds(void);
 extern time64_t ktime_get_real_seconds(void);
 
-extern int __getnstimeofday64(struct timespec64 *tv);
-extern void getnstimeofday64(struct timespec64 *tv);
 extern void getboottime64(struct timespec64 *ts);
 
-#define ktime_get_real_ts64(ts)        getnstimeofday64(ts)
 
 /*
  * ktime_t based interfaces
@@ -210,5 +208,9 @@ extern void read_persistent_clock64(struct timespec64 *ts);
 extern void read_boot_clock64(struct timespec64 *ts);
 extern int update_persistent_clock64(struct timespec64 now);
 
+/*
+ * deprecated aliases, don't use in new code
+ */
+#define getnstimeofday64(ts)           ktime_get_real_ts64(ts)
 
 #endif
index 4ea45d0df1d4b68e67a0f03622568905a5fa3969..5abff52d07fd2cba8114147f2fb3554ebd9214bd 100644 (file)
@@ -27,20 +27,11 @@ static inline int do_settimeofday(const struct timespec *ts)
        return do_settimeofday64(&ts64);
 }
 
-static inline int __getnstimeofday(struct timespec *ts)
-{
-       struct timespec64 ts64;
-       int ret = __getnstimeofday64(&ts64);
-
-       *ts = timespec64_to_timespec(ts64);
-       return ret;
-}
-
 static inline void getnstimeofday(struct timespec *ts)
 {
        struct timespec64 ts64;
 
-       getnstimeofday64(&ts64);
+       ktime_get_real_ts64(&ts64);
        *ts = timespec64_to_timespec(ts64);
 }
 
@@ -56,7 +47,7 @@ static inline void ktime_get_real_ts(struct timespec *ts)
 {
        struct timespec64 ts64;
 
-       getnstimeofday64(&ts64);
+       ktime_get_real_ts64(&ts64);
        *ts = timespec64_to_timespec(ts64);
 }
 
index 49cbceef5debc7c06aab4f4f5a2479b291855ee7..7bbc7a6e6095e55aba1c4a27103957048b3bd8f8 100644 (file)
@@ -705,18 +705,19 @@ static void timekeeping_forward_now(struct timekeeper *tk)
 }
 
 /**
- * __getnstimeofday64 - Returns the time of day in a timespec64.
+ * ktime_get_real_ts64 - Returns the time of day in a timespec64.
  * @ts:                pointer to the timespec to be set
  *
- * Updates the time of day in the timespec.
- * Returns 0 on success, or -ve when suspended (timespec will be undefined).
+ * Returns the time of day in a timespec64 (WARN if suspended).
  */
-int __getnstimeofday64(struct timespec64 *ts)
+void ktime_get_real_ts64(struct timespec64 *ts)
 {
        struct timekeeper *tk = &tk_core.timekeeper;
        unsigned long seq;
        u64 nsecs;
 
+       WARN_ON(timekeeping_suspended);
+
        do {
                seq = read_seqcount_begin(&tk_core.seq);
 
@@ -727,28 +728,8 @@ int __getnstimeofday64(struct timespec64 *ts)
 
        ts->tv_nsec = 0;
        timespec64_add_ns(ts, nsecs);
-
-       /*
-        * Do not bail out early, in case there were callers still using
-        * the value, even in the face of the WARN_ON.
-        */
-       if (unlikely(timekeeping_suspended))
-               return -EAGAIN;
-       return 0;
-}
-EXPORT_SYMBOL(__getnstimeofday64);
-
-/**
- * getnstimeofday64 - Returns the time of day in a timespec64.
- * @ts:                pointer to the timespec64 to be set
- *
- * Returns the time of day in a timespec64 (WARN if suspended).
- */
-void getnstimeofday64(struct timespec64 *ts)
-{
-       WARN_ON(__getnstimeofday64(ts));
 }
-EXPORT_SYMBOL(getnstimeofday64);
+EXPORT_SYMBOL(ktime_get_real_ts64);
 
 ktime_t ktime_get(void)
 {