y2038: remove unused time interfaces
authorArnd Bergmann <arnd@arndb.de>
Tue, 14 Aug 2018 12:02:57 +0000 (14:02 +0200)
committerArnd Bergmann <arnd@arndb.de>
Mon, 27 Aug 2018 10:59:56 +0000 (12:59 +0200)
After many small patches, at least some of the deprecated interfaces
have no remaining users any more and can be removed:

  current_kernel_time
  do_settimeofday
  get_monotonic_boottime
  get_monotonic_boottime64
  get_monotonic_coarse
  get_monotonic_coarse64
  getrawmonotonic64
  ktime_get_real_ts
  timekeeping_clocktai
  timespec_trunc
  timespec_valid_strict
  time_to_tm

For many of the remaining time functions, we are missing one or
two patches that failed to make it into 4.19, they will be removed
in the following merge window.

The replacement functions for the removed interfaces are documented in
Documentation/core-api/timekeeping.rst.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
include/linux/time32.h
include/linux/timekeeping.h
include/linux/timekeeping32.h
kernel/time/time.c

index d1ae43c13e25940e2febed51919c171e3018ed3f..92c0ca092d93e26f796751fe9f68ca1d2cf098b2 100644 (file)
@@ -105,16 +105,6 @@ static inline bool timespec_valid(const struct timespec *ts)
        return true;
 }
 
-static inline bool timespec_valid_strict(const struct timespec *ts)
-{
-       if (!timespec_valid(ts))
-               return false;
-       /* Disallow values that could overflow ktime_t */
-       if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
-               return false;
-       return true;
-}
-
 /**
  * timespec_to_ns - Convert timespec to nanoseconds
  * @ts:                pointer to the timespec variable to be converted
@@ -149,19 +139,6 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
        a->tv_nsec = ns;
 }
 
-/**
- * time_to_tm - converts the calendar time to local broken-down time
- *
- * @totalsecs  the number of seconds elapsed since 00:00:00 on January 1, 1970,
- *             Coordinated Universal Time (UTC).
- * @offset     offset seconds adding to totalsecs.
- * @result     pointer to struct tm variable to receive broken-down time
- */
-static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
-{
-       time64_to_tm(totalsecs, offset, result);
-}
-
 static inline unsigned long mktime(const unsigned int year,
                        const unsigned int mon, const unsigned int day,
                        const unsigned int hour, const unsigned int min,
@@ -183,8 +160,6 @@ static inline bool timeval_valid(const struct timeval *tv)
        return true;
 }
 
-extern struct timespec timespec_trunc(struct timespec t, unsigned int gran);
-
 /**
  * timeval_to_ns - Convert timeval to nanoseconds
  * @ts:                pointer to the timeval variable to be converted
index 5d738804e3d6241dae4961c93324efbdd4f5aaea..3faba06411aab1eb2d2e669e97b08b30372a552d 100644 (file)
@@ -266,9 +266,6 @@ extern int update_persistent_clock64(struct timespec64 now);
  * deprecated aliases, don't use in new code
  */
 #define getnstimeofday64(ts)           ktime_get_real_ts64(ts)
-#define get_monotonic_boottime64(ts)   ktime_get_boottime_ts64(ts)
-#define getrawmonotonic64(ts)          ktime_get_raw_ts64(ts)
-#define timekeeping_clocktai64(ts)     ktime_get_clocktai_ts64(ts)
 
 static inline struct timespec64 current_kernel_time64(void)
 {
@@ -279,13 +276,4 @@ static inline struct timespec64 current_kernel_time64(void)
        return ts;
 }
 
-static inline struct timespec64 get_monotonic_coarse64(void)
-{
-       struct timespec64 ts;
-
-       ktime_get_coarse_ts64(&ts);
-
-       return ts;
-}
-
 #endif
index 8762c2f45f8bf1b1ac13b5b15891115df8223dd8..a4a4991160fb2f759581a6d94868cad8bd9458ba 100644 (file)
@@ -9,26 +9,6 @@
 extern void do_gettimeofday(struct timeval *tv);
 unsigned long get_seconds(void);
 
-static inline struct timespec current_kernel_time(void)
-{
-       struct timespec64 ts64;
-
-       ktime_get_coarse_real_ts64(&ts64);
-
-       return timespec64_to_timespec(ts64);
-}
-
-/**
- * Deprecated. Use do_settimeofday64().
- */
-static inline int do_settimeofday(const struct timespec *ts)
-{
-       struct timespec64 ts64;
-
-       ts64 = timespec_to_timespec64(*ts);
-       return do_settimeofday64(&ts64);
-}
-
 static inline void getnstimeofday(struct timespec *ts)
 {
        struct timespec64 ts64;
@@ -45,14 +25,6 @@ static inline void ktime_get_ts(struct timespec *ts)
        *ts = timespec64_to_timespec(ts64);
 }
 
-static inline void ktime_get_real_ts(struct timespec *ts)
-{
-       struct timespec64 ts64;
-
-       ktime_get_real_ts64(&ts64);
-       *ts = timespec64_to_timespec(ts64);
-}
-
 static inline void getrawmonotonic(struct timespec *ts)
 {
        struct timespec64 ts64;
@@ -61,15 +33,6 @@ static inline void getrawmonotonic(struct timespec *ts)
        *ts = timespec64_to_timespec(ts64);
 }
 
-static inline struct timespec get_monotonic_coarse(void)
-{
-       struct timespec64 ts64;
-
-       ktime_get_coarse_ts64(&ts64);
-
-       return timespec64_to_timespec(ts64);
-}
-
 static inline void getboottime(struct timespec *ts)
 {
        struct timespec64 ts64;
@@ -78,19 +41,6 @@ static inline void getboottime(struct timespec *ts)
        *ts = timespec64_to_timespec(ts64);
 }
 
-/*
- * Timespec interfaces utilizing the ktime based ones
- */
-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());
-}
-
 /*
  * Persistent clock related interfaces
  */
index ccdb351277eecf739605be2e98b44174de595883..7125430111067facc95930d930ed22efb91ee716 100644 (file)
@@ -342,30 +342,6 @@ unsigned int jiffies_to_usecs(const unsigned long j)
 }
 EXPORT_SYMBOL(jiffies_to_usecs);
 
-/**
- * timespec_trunc - Truncate timespec to a granularity
- * @t: Timespec
- * @gran: Granularity in ns.
- *
- * Truncate a timespec to a granularity. Always rounds down. gran must
- * not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
- */
-struct timespec timespec_trunc(struct timespec t, unsigned gran)
-{
-       /* Avoid division in the common cases 1 ns and 1 s. */
-       if (gran == 1) {
-               /* nothing */
-       } else if (gran == NSEC_PER_SEC) {
-               t.tv_nsec = 0;
-       } else if (gran > 1 && gran < NSEC_PER_SEC) {
-               t.tv_nsec -= t.tv_nsec % gran;
-       } else {
-               WARN(1, "illegal file time granularity: %u", gran);
-       }
-       return t;
-}
-EXPORT_SYMBOL(timespec_trunc);
-
 /*
  * mktime64 - Converts date to seconds.
  * Converts Gregorian date to seconds since 1970-01-01 00:00:00.