Skip to content

Commit 1b64244

Browse files
arndbintel-lab-lkp
authored andcommitted
y2038: Remove unused time interfaces
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>
1 parent 050cdc6 commit 1b64244

File tree

4 files changed

+0
-111
lines changed

4 files changed

+0
-111
lines changed

include/linux/time32.h

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,6 @@ static inline bool timespec_valid(const struct timespec *ts)
105105
return true;
106106
}
107107

108-
static inline bool timespec_valid_strict(const struct timespec *ts)
109-
{
110-
if (!timespec_valid(ts))
111-
return false;
112-
/* Disallow values that could overflow ktime_t */
113-
if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX)
114-
return false;
115-
return true;
116-
}
117-
118108
/**
119109
* timespec_to_ns - Convert timespec to nanoseconds
120110
* @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)
149139
a->tv_nsec = ns;
150140
}
151141

152-
/**
153-
* time_to_tm - converts the calendar time to local broken-down time
154-
*
155-
* @totalsecs the number of seconds elapsed since 00:00:00 on January 1, 1970,
156-
* Coordinated Universal Time (UTC).
157-
* @offset offset seconds adding to totalsecs.
158-
* @result pointer to struct tm variable to receive broken-down time
159-
*/
160-
static inline void time_to_tm(time_t totalsecs, int offset, struct tm *result)
161-
{
162-
time64_to_tm(totalsecs, offset, result);
163-
}
164-
165142
static inline unsigned long mktime(const unsigned int year,
166143
const unsigned int mon, const unsigned int day,
167144
const unsigned int hour, const unsigned int min,
@@ -183,8 +160,6 @@ static inline bool timeval_valid(const struct timeval *tv)
183160
return true;
184161
}
185162

186-
extern struct timespec timespec_trunc(struct timespec t, unsigned int gran);
187-
188163
/**
189164
* timeval_to_ns - Convert timeval to nanoseconds
190165
* @ts: pointer to the timeval variable to be converted

include/linux/timekeeping.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ extern int update_persistent_clock64(struct timespec64 now);
266266
* deprecated aliases, don't use in new code
267267
*/
268268
#define getnstimeofday64(ts) ktime_get_real_ts64(ts)
269-
#define get_monotonic_boottime64(ts) ktime_get_boottime_ts64(ts)
270-
#define getrawmonotonic64(ts) ktime_get_raw_ts64(ts)
271-
#define timekeeping_clocktai64(ts) ktime_get_clocktai_ts64(ts)
272269

273270
static inline struct timespec64 current_kernel_time64(void)
274271
{
@@ -279,13 +276,4 @@ static inline struct timespec64 current_kernel_time64(void)
279276
return ts;
280277
}
281278

282-
static inline struct timespec64 get_monotonic_coarse64(void)
283-
{
284-
struct timespec64 ts;
285-
286-
ktime_get_coarse_ts64(&ts);
287-
288-
return ts;
289-
}
290-
291279
#endif

include/linux/timekeeping32.h

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,6 @@
99
extern void do_gettimeofday(struct timeval *tv);
1010
unsigned long get_seconds(void);
1111

12-
static inline struct timespec current_kernel_time(void)
13-
{
14-
struct timespec64 ts64;
15-
16-
ktime_get_coarse_real_ts64(&ts64);
17-
18-
return timespec64_to_timespec(ts64);
19-
}
20-
21-
/**
22-
* Deprecated. Use do_settimeofday64().
23-
*/
24-
static inline int do_settimeofday(const struct timespec *ts)
25-
{
26-
struct timespec64 ts64;
27-
28-
ts64 = timespec_to_timespec64(*ts);
29-
return do_settimeofday64(&ts64);
30-
}
31-
3212
static inline void getnstimeofday(struct timespec *ts)
3313
{
3414
struct timespec64 ts64;
@@ -45,14 +25,6 @@ static inline void ktime_get_ts(struct timespec *ts)
4525
*ts = timespec64_to_timespec(ts64);
4626
}
4727

48-
static inline void ktime_get_real_ts(struct timespec *ts)
49-
{
50-
struct timespec64 ts64;
51-
52-
ktime_get_real_ts64(&ts64);
53-
*ts = timespec64_to_timespec(ts64);
54-
}
55-
5628
static inline void getrawmonotonic(struct timespec *ts)
5729
{
5830
struct timespec64 ts64;
@@ -61,15 +33,6 @@ static inline void getrawmonotonic(struct timespec *ts)
6133
*ts = timespec64_to_timespec(ts64);
6234
}
6335

64-
static inline struct timespec get_monotonic_coarse(void)
65-
{
66-
struct timespec64 ts64;
67-
68-
ktime_get_coarse_ts64(&ts64);
69-
70-
return timespec64_to_timespec(ts64);
71-
}
72-
7336
static inline void getboottime(struct timespec *ts)
7437
{
7538
struct timespec64 ts64;
@@ -78,19 +41,6 @@ static inline void getboottime(struct timespec *ts)
7841
*ts = timespec64_to_timespec(ts64);
7942
}
8043

81-
/*
82-
* Timespec interfaces utilizing the ktime based ones
83-
*/
84-
static inline void get_monotonic_boottime(struct timespec *ts)
85-
{
86-
*ts = ktime_to_timespec(ktime_get_boottime());
87-
}
88-
89-
static inline void timekeeping_clocktai(struct timespec *ts)
90-
{
91-
*ts = ktime_to_timespec(ktime_get_clocktai());
92-
}
93-
9444
/*
9545
* Persistent clock related interfaces
9646
*/

kernel/time/time.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -342,30 +342,6 @@ unsigned int jiffies_to_usecs(const unsigned long j)
342342
}
343343
EXPORT_SYMBOL(jiffies_to_usecs);
344344

345-
/**
346-
* timespec_trunc - Truncate timespec to a granularity
347-
* @t: Timespec
348-
* @gran: Granularity in ns.
349-
*
350-
* Truncate a timespec to a granularity. Always rounds down. gran must
351-
* not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
352-
*/
353-
struct timespec timespec_trunc(struct timespec t, unsigned gran)
354-
{
355-
/* Avoid division in the common cases 1 ns and 1 s. */
356-
if (gran == 1) {
357-
/* nothing */
358-
} else if (gran == NSEC_PER_SEC) {
359-
t.tv_nsec = 0;
360-
} else if (gran > 1 && gran < NSEC_PER_SEC) {
361-
t.tv_nsec -= t.tv_nsec % gran;
362-
} else {
363-
WARN(1, "illegal file time granularity: %u", gran);
364-
}
365-
return t;
366-
}
367-
EXPORT_SYMBOL(timespec_trunc);
368-
369345
/*
370346
* mktime64 - Converts date to seconds.
371347
* Converts Gregorian date to seconds since 1970-01-01 00:00:00.

0 commit comments

Comments
 (0)