Skip to content

Commit

Permalink
timekeeping: Simplify timekeeping_clocktai()
Browse files Browse the repository at this point in the history
timekeeping_clocktai() is not used in fast pathes, so the extra
timespec conversion is not problematic.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
Thomas Gleixner authored and John Stultz committed Jul 23, 2014
1 parent 47da70d commit 61edec8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
5 changes: 5 additions & 0 deletions include/linux/timekeeping.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ static inline void get_monotonic_boottime(struct timespec *ts)
*ts = ktime_to_timespec(ktime_get_boottime());
}

static inline void timekeeping_clocktai(struct timespec *ts)
{
*ts = ktime_to_timespec(ktime_get_clocktai());
}

/*
* RTC specific
*/
Expand Down
31 changes: 0 additions & 31 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,37 +497,6 @@ void ktime_get_ts64(struct timespec64 *ts)
}
EXPORT_SYMBOL_GPL(ktime_get_ts64);


/**
* timekeeping_clocktai - Returns the TAI time of day in a timespec
* @ts: pointer to the timespec to be set
*
* Returns the time of day in a timespec.
*/
void timekeeping_clocktai(struct timespec *ts)
{
struct timekeeper *tk = &tk_core.timekeeper;
struct timespec64 ts64;
unsigned long seq;
u64 nsecs;

WARN_ON(timekeeping_suspended);

do {
seq = read_seqcount_begin(&tk_core.seq);

ts64.tv_sec = tk->xtime_sec + tk->tai_offset;
nsecs = timekeeping_get_ns(tk);

} while (read_seqcount_retry(&tk_core.seq, seq));

ts64.tv_nsec = 0;
timespec64_add_ns(&ts64, nsecs);
*ts = timespec64_to_timespec(ts64);

}
EXPORT_SYMBOL(timekeeping_clocktai);

#ifdef CONFIG_NTP_PPS

/**
Expand Down

0 comments on commit 61edec8

Please sign in to comment.