Skip to content

Commit 437e78d

Browse files
committed
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>
1 parent 9266178 commit 437e78d

2 files changed

Lines changed: 0 additions & 61 deletions

File tree

‎include/linux/time32.h‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,6 @@ static inline int timespec_compare(const struct timespec *lhs, const struct time
9696
return lhs->tv_nsec - rhs->tv_nsec;
9797
}
9898

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-
12499
/*
125100
* Returns true if the timespec is norm, false if denorm:
126101
*/

‎kernel/time/time.c‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -386,42 +386,6 @@ time64_t mktime64(const unsigned int year0, const unsigned int mon0,
386386
}
387387
EXPORT_SYMBOL(mktime64);
388388

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-
425389
/**
426390
* ns_to_timespec - Convert nanoseconds to timespec
427391
* @nsec: the nanoseconds value to be converted

0 commit comments

Comments
 (0)