Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

y2038: remove ktime to/from timespec/timeval conversion

A couple of helpers are now obsolete and can be removed, so drivers can no
longer start using them and instead use y2038-safe interfaces.

Link: http://lkml.kernel.org/r/20200110154232.4104492-2-arnd@arndb.de
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Arnd Bergmann and committed by
Linus Torvalds
595abbaf ca7e1fd1

-37
-37
include/linux/ktime.h
··· 66 66 */ 67 67 #define ktime_sub_ns(kt, nsval) ((kt) - (nsval)) 68 68 69 - /* convert a timespec to ktime_t format: */ 70 - static inline ktime_t timespec_to_ktime(struct timespec ts) 71 - { 72 - return ktime_set(ts.tv_sec, ts.tv_nsec); 73 - } 74 - 75 69 /* convert a timespec64 to ktime_t format: */ 76 70 static inline ktime_t timespec64_to_ktime(struct timespec64 ts) 77 71 { 78 72 return ktime_set(ts.tv_sec, ts.tv_nsec); 79 73 } 80 74 81 - /* convert a timeval to ktime_t format: */ 82 - static inline ktime_t timeval_to_ktime(struct timeval tv) 83 - { 84 - return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC); 85 - } 86 - 87 - /* Map the ktime_t to timespec conversion to ns_to_timespec function */ 88 - #define ktime_to_timespec(kt) ns_to_timespec((kt)) 89 - 90 75 /* Map the ktime_t to timespec conversion to ns_to_timespec function */ 91 76 #define ktime_to_timespec64(kt) ns_to_timespec64((kt)) 92 - 93 - /* Map the ktime_t to timeval conversion to ns_to_timeval function */ 94 - #define ktime_to_timeval(kt) ns_to_timeval((kt)) 95 77 96 78 /* Convert ktime_t to nanoseconds */ 97 79 static inline s64 ktime_to_ns(const ktime_t kt) ··· 196 214 } 197 215 198 216 extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 199 - 200 - /** 201 - * ktime_to_timespec_cond - convert a ktime_t variable to timespec 202 - * format only if the variable contains data 203 - * @kt: the ktime_t variable to convert 204 - * @ts: the timespec variable to store the result in 205 - * 206 - * Return: %true if there was a successful conversion, %false if kt was 0. 207 - */ 208 - static inline __must_check bool ktime_to_timespec_cond(const ktime_t kt, 209 - struct timespec *ts) 210 - { 211 - if (kt) { 212 - *ts = ktime_to_timespec(kt); 213 - return true; 214 - } else { 215 - return false; 216 - } 217 - } 218 217 219 218 /** 220 219 * ktime_to_timespec64_cond - convert a ktime_t variable to timespec64