Commit 7d489d15 authored by John Stultz's avatar John Stultz

timekeeping: Convert timekeeping core to use timespec64s

Convert the core timekeeping logic to use timespec64s. This moves the
2038 issues out of the core logic and into all of the accessor
functions.

Future changes will need to push the timespec64s out to all
timekeeping users, but that can be done interface by interface.
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 49cd6f86
...@@ -55,15 +55,15 @@ struct timekeeper { ...@@ -55,15 +55,15 @@ struct timekeeper {
* - wall_to_monotonic is no longer the boot time, getboottime must be * - wall_to_monotonic is no longer the boot time, getboottime must be
* used instead. * used instead.
*/ */
struct timespec wall_to_monotonic; struct timespec64 wall_to_monotonic;
/* Offset clock monotonic -> clock realtime */ /* Offset clock monotonic -> clock realtime */
ktime_t offs_real; ktime_t offs_real;
/* time spent in suspend */ /* time spent in suspend */
struct timespec total_sleep_time; struct timespec64 total_sleep_time;
/* Offset clock monotonic -> clock boottime */ /* Offset clock monotonic -> clock boottime */
ktime_t offs_boot; ktime_t offs_boot;
/* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
struct timespec raw_time; struct timespec64 raw_time;
/* The current UTC to TAI offset in seconds */ /* The current UTC to TAI offset in seconds */
s32 tai_offset; s32 tai_offset;
/* Offset clock monotonic -> clock tai */ /* Offset clock monotonic -> clock tai */
...@@ -71,9 +71,9 @@ struct timekeeper { ...@@ -71,9 +71,9 @@ struct timekeeper {
}; };
static inline struct timespec tk_xtime(struct timekeeper *tk) static inline struct timespec64 tk_xtime(struct timekeeper *tk)
{ {
struct timespec ts; struct timespec64 ts;
ts.tv_sec = tk->xtime_sec; ts.tv_sec = tk->xtime_sec;
ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift); ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
......
...@@ -531,7 +531,7 @@ void ntp_notify_cmos_timer(void) { } ...@@ -531,7 +531,7 @@ void ntp_notify_cmos_timer(void) { }
/* /*
* Propagate a new txc->status value into the NTP state: * Propagate a new txc->status value into the NTP state:
*/ */
static inline void process_adj_status(struct timex *txc, struct timespec *ts) static inline void process_adj_status(struct timex *txc, struct timespec64 *ts)
{ {
if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) { if ((time_status & STA_PLL) && !(txc->status & STA_PLL)) {
time_state = TIME_OK; time_state = TIME_OK;
...@@ -554,7 +554,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts) ...@@ -554,7 +554,7 @@ static inline void process_adj_status(struct timex *txc, struct timespec *ts)
static inline void process_adjtimex_modes(struct timex *txc, static inline void process_adjtimex_modes(struct timex *txc,
struct timespec *ts, struct timespec64 *ts,
s32 *time_tai) s32 *time_tai)
{ {
if (txc->modes & ADJ_STATUS) if (txc->modes & ADJ_STATUS)
...@@ -640,7 +640,7 @@ int ntp_validate_timex(struct timex *txc) ...@@ -640,7 +640,7 @@ int ntp_validate_timex(struct timex *txc)
* adjtimex mainly allows reading (and writing, if superuser) of * adjtimex mainly allows reading (and writing, if superuser) of
* kernel time-keeping variables. used by xntpd. * kernel time-keeping variables. used by xntpd.
*/ */
int __do_adjtimex(struct timex *txc, struct timespec *ts, s32 *time_tai) int __do_adjtimex(struct timex *txc, struct timespec64 *ts, s32 *time_tai)
{ {
int result; int result;
...@@ -684,7 +684,7 @@ int __do_adjtimex(struct timex *txc, struct timespec *ts, s32 *time_tai) ...@@ -684,7 +684,7 @@ int __do_adjtimex(struct timex *txc, struct timespec *ts, s32 *time_tai)
/* fill PPS status fields */ /* fill PPS status fields */
pps_fill_timex(txc); pps_fill_timex(txc);
txc->time.tv_sec = ts->tv_sec; txc->time.tv_sec = (time_t)ts->tv_sec;
txc->time.tv_usec = ts->tv_nsec; txc->time.tv_usec = ts->tv_nsec;
if (!(time_status & STA_NANO)) if (!(time_status & STA_NANO))
txc->time.tv_usec /= NSEC_PER_USEC; txc->time.tv_usec /= NSEC_PER_USEC;
......
...@@ -7,6 +7,6 @@ extern void ntp_clear(void); ...@@ -7,6 +7,6 @@ extern void ntp_clear(void);
extern u64 ntp_tick_length(void); extern u64 ntp_tick_length(void);
extern int second_overflow(unsigned long secs); extern int second_overflow(unsigned long secs);
extern int ntp_validate_timex(struct timex *); extern int ntp_validate_timex(struct timex *);
extern int __do_adjtimex(struct timex *, struct timespec *, s32 *); extern int __do_adjtimex(struct timex *, struct timespec64 *, s32 *);
extern void __hardpps(const struct timespec *, const struct timespec *); extern void __hardpps(const struct timespec *, const struct timespec *);
#endif /* _LINUX_NTP_INTERNAL_H */ #endif /* _LINUX_NTP_INTERNAL_H */
This diff is collapsed.
...@@ -67,7 +67,7 @@ static int __init tk_debug_sleep_time_init(void) ...@@ -67,7 +67,7 @@ static int __init tk_debug_sleep_time_init(void)
} }
late_initcall(tk_debug_sleep_time_init); late_initcall(tk_debug_sleep_time_init);
void tk_debug_account_sleep_time(struct timespec *t) void tk_debug_account_sleep_time(struct timespec64 *t)
{ {
sleep_time_bin[fls(t->tv_sec)]++; sleep_time_bin[fls(t->tv_sec)]++;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <linux/time.h> #include <linux/time.h>
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
extern void tk_debug_account_sleep_time(struct timespec *t); extern void tk_debug_account_sleep_time(struct timespec64 *t);
#else #else
#define tk_debug_account_sleep_time(x) #define tk_debug_account_sleep_time(x)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment