diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-12-07 07:41:02 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2018-12-18 10:13:05 -0500 |
commit | 437e78d3fd6d35e6d56230962e6d03bb5dcda7f6 (patch) | |
tree | f9f3884d077e344326bfc26d2c894984beb92d60 | |
parent | 926617889dc8383a120c66a2ecf7959a69f96950 (diff) |
timekeeping: remove timespec_add/timespec_del
The last users were removed a while ago since everyone moved to ktime_t,
so we can remove the two unused interfaces for old timespec structures.
With those two gone, set_normalized_timespec() is also unused, so
remove that as well.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: John Stultz <john.stultz@linaro.org>
-rw-r--r-- | include/linux/time32.h | 25 | ||||
-rw-r--r-- | kernel/time/time.c | 36 |
2 files changed, 0 insertions, 61 deletions
diff --git a/include/linux/time32.h b/include/linux/time32.h index 61904a6c098f..118b9977080c 100644 --- a/include/linux/time32.h +++ b/include/linux/time32.h | |||
@@ -96,31 +96,6 @@ static inline int timespec_compare(const struct timespec *lhs, const struct time | |||
96 | return lhs->tv_nsec - rhs->tv_nsec; | 96 | return lhs->tv_nsec - rhs->tv_nsec; |
97 | } | 97 | } |
98 | 98 | ||
99 | extern void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec); | ||
100 | |||
101 | static inline struct timespec timespec_add(struct timespec lhs, | ||
102 | struct timespec rhs) | ||
103 | { | ||
104 | struct timespec ts_delta; | ||
105 | |||
106 | set_normalized_timespec(&ts_delta, lhs.tv_sec + rhs.tv_sec, | ||
107 | lhs.tv_nsec + rhs.tv_nsec); | ||
108 | return ts_delta; | ||
109 | } | ||
110 | |||
111 | /* | ||
112 | * sub = lhs - rhs, in normalized form | ||
113 | */ | ||
114 | static inline struct timespec timespec_sub(struct timespec lhs, | ||
115 | struct timespec rhs) | ||
116 | { | ||
117 | struct timespec ts_delta; | ||
118 | |||
119 | set_normalized_timespec(&ts_delta, lhs.tv_sec - rhs.tv_sec, | ||
120 | lhs.tv_nsec - rhs.tv_nsec); | ||
121 | return ts_delta; | ||
122 | } | ||
123 | |||
124 | /* | 99 | /* |
125 | * Returns true if the timespec is norm, false if denorm: | 100 | * Returns true if the timespec is norm, false if denorm: |
126 | */ | 101 | */ |
diff --git a/kernel/time/time.c b/kernel/time/time.c index ad204cf6d001..532bb560252d 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c | |||
@@ -387,42 +387,6 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0, | |||
387 | EXPORT_SYMBOL(mktime64); | 387 | EXPORT_SYMBOL(mktime64); |
388 | 388 | ||
389 | /** | 389 | /** |
390 | * set_normalized_timespec - set timespec sec and nsec parts and normalize | ||
391 | * | ||
392 | * @ts: pointer to timespec variable to be set | ||
393 | * @sec: seconds to set | ||
394 | * @nsec: nanoseconds to set | ||
395 | * | ||
396 | * Set seconds and nanoseconds field of a timespec variable and | ||
397 | * normalize to the timespec storage format | ||
398 | * | ||
399 | * Note: The tv_nsec part is always in the range of | ||
400 | * 0 <= tv_nsec < NSEC_PER_SEC | ||
401 | * For negative values only the tv_sec field is negative ! | ||
402 | */ | ||
403 | void set_normalized_timespec(struct timespec *ts, time_t sec, s64 nsec) | ||
404 | { | ||
405 | while (nsec >= NSEC_PER_SEC) { | ||
406 | /* | ||
407 | * The following asm() prevents the compiler from | ||
408 | * optimising this loop into a modulo operation. See | ||
409 | * also __iter_div_u64_rem() in include/linux/time.h | ||
410 | */ | ||
411 | asm("" : "+rm"(nsec)); | ||
412 | nsec -= NSEC_PER_SEC; | ||
413 | ++sec; | ||
414 | } | ||
415 | while (nsec < 0) { | ||
416 | asm("" : "+rm"(nsec)); | ||
417 | nsec += NSEC_PER_SEC; | ||
418 | --sec; | ||
419 | } | ||
420 | ts->tv_sec = sec; | ||
421 | ts->tv_nsec = nsec; | ||
422 | } | ||
423 | EXPORT_SYMBOL(set_normalized_timespec); | ||
424 | |||
425 | /** | ||
426 | * ns_to_timespec - Convert nanoseconds to timespec | 390 | * ns_to_timespec - Convert nanoseconds to timespec |
427 | * @nsec: the nanoseconds value to be converted | 391 | * @nsec: the nanoseconds value to be converted |
428 | * | 392 | * |