timekeeping: Standardize on ktime_get_*() naming
The current_kernel_time64, get_monotonic_coarse64, getrawmonotonic64, get_monotonic_boottime64 and timekeeping_clocktai64 interfaces have rather inconsistent naming, and they differ in the calling conventions by passing the output either by reference or as a return value. Rename them to ktime_get_coarse_real_ts64, ktime_get_coarse_ts64, ktime_get_raw_ts64, ktime_get_boottime_ts64 and ktime_get_clocktai_ts64 respectively, and provide the interfaces with macros or inline functions as needed. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Stephen Boyd <sboyd@kernel.org> Cc: y2038@lists.linaro.org Cc: John Stultz <john.stultz@linaro.org> Link: https://lkml.kernel.org/r/20180427134016.2525989-4-arnd@arndb.de
This commit is contained in:

committed by
Thomas Gleixner

parent
edca71fecb
commit
fb7fcc96a8
@@ -1391,12 +1391,12 @@ int timekeeping_notify(struct clocksource *clock)
|
||||
}
|
||||
|
||||
/**
|
||||
* getrawmonotonic64 - Returns the raw monotonic time in a timespec
|
||||
* ktime_get_raw_ts64 - Returns the raw monotonic time in a timespec
|
||||
* @ts: pointer to the timespec64 to be set
|
||||
*
|
||||
* Returns the raw monotonic time (completely un-modified by ntp)
|
||||
*/
|
||||
void getrawmonotonic64(struct timespec64 *ts)
|
||||
void ktime_get_raw_ts64(struct timespec64 *ts)
|
||||
{
|
||||
struct timekeeper *tk = &tk_core.timekeeper;
|
||||
unsigned long seq;
|
||||
@@ -1412,7 +1412,7 @@ void getrawmonotonic64(struct timespec64 *ts)
|
||||
ts->tv_nsec = 0;
|
||||
timespec64_add_ns(ts, nsecs);
|
||||
}
|
||||
EXPORT_SYMBOL(getrawmonotonic64);
|
||||
EXPORT_SYMBOL(ktime_get_raw_ts64);
|
||||
|
||||
|
||||
/**
|
||||
@@ -2114,23 +2114,20 @@ unsigned long get_seconds(void)
|
||||
}
|
||||
EXPORT_SYMBOL(get_seconds);
|
||||
|
||||
struct timespec64 current_kernel_time64(void)
|
||||
void ktime_get_coarse_real_ts64(struct timespec64 *ts)
|
||||
{
|
||||
struct timekeeper *tk = &tk_core.timekeeper;
|
||||
struct timespec64 now;
|
||||
unsigned long seq;
|
||||
|
||||
do {
|
||||
seq = read_seqcount_begin(&tk_core.seq);
|
||||
|
||||
now = tk_xtime(tk);
|
||||
*ts = tk_xtime(tk);
|
||||
} while (read_seqcount_retry(&tk_core.seq, seq));
|
||||
|
||||
return now;
|
||||
}
|
||||
EXPORT_SYMBOL(current_kernel_time64);
|
||||
EXPORT_SYMBOL(ktime_get_coarse_real_ts64);
|
||||
|
||||
struct timespec64 get_monotonic_coarse64(void)
|
||||
void ktime_get_coarse_ts64(struct timespec64 *ts)
|
||||
{
|
||||
struct timekeeper *tk = &tk_core.timekeeper;
|
||||
struct timespec64 now, mono;
|
||||
@@ -2143,12 +2140,10 @@ struct timespec64 get_monotonic_coarse64(void)
|
||||
mono = tk->wall_to_monotonic;
|
||||
} while (read_seqcount_retry(&tk_core.seq, seq));
|
||||
|
||||
set_normalized_timespec64(&now, now.tv_sec + mono.tv_sec,
|
||||
set_normalized_timespec64(ts, now.tv_sec + mono.tv_sec,
|
||||
now.tv_nsec + mono.tv_nsec);
|
||||
|
||||
return now;
|
||||
}
|
||||
EXPORT_SYMBOL(get_monotonic_coarse64);
|
||||
EXPORT_SYMBOL(ktime_get_coarse_ts64);
|
||||
|
||||
/*
|
||||
* Must hold jiffies_lock
|
||||
|
Reference in New Issue
Block a user