From: Arnd Bergmann <arnd@arndb.de> To: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>, John Stultz <john.stultz@linaro.org>, y2038@lists.linaro.org, Arnd Bergmann <arnd@arndb.de> Subject: [PATCH 2/5] timekeeping: Clean up ktime_get_real_ts64 Date: Fri, 27 Apr 2018 15:40:13 +0200 [thread overview] Message-ID: <20180427134016.2525989-3-arnd@arndb.de> (raw) In-Reply-To: <20180427134016.2525989-1-arnd@arndb.de> In a move to make ktime_get_*() the preferred driver interface into the timekeeping code, sanitizes ktime_get_real_ts64() to be a proper exported symbol rather than an alias for getnstimeofday64(). The internal __getnstimeofday64() is no longer used, so remove that and merge it into ktime_get_real_ts64(). Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- include/linux/timekeeping.h | 8 +++++--- include/linux/timekeeping32.h | 13 ++----------- kernel/time/timekeeping.c | 31 ++++++------------------------- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 588a0e4b1ab9..415dae6bf1f5 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -30,15 +30,13 @@ struct timespec64 current_kernel_time64(void); struct timespec64 get_monotonic_coarse64(void); extern void getrawmonotonic64(struct timespec64 *ts); extern void ktime_get_ts64(struct timespec64 *ts); +extern void ktime_get_real_ts64(struct timespec64 *tv); extern time64_t ktime_get_seconds(void); extern time64_t __ktime_get_real_seconds(void); extern time64_t ktime_get_real_seconds(void); -extern int __getnstimeofday64(struct timespec64 *tv); -extern void getnstimeofday64(struct timespec64 *tv); extern void getboottime64(struct timespec64 *ts); -#define ktime_get_real_ts64(ts) getnstimeofday64(ts) /* * ktime_t based interfaces @@ -210,5 +208,9 @@ extern void read_persistent_clock64(struct timespec64 *ts); extern void read_boot_clock64(struct timespec64 *ts); extern int update_persistent_clock64(struct timespec64 now); +/* + * deprecated aliases, don't use in new code + */ +#define getnstimeofday64(ts) ktime_get_real_ts64(ts) #endif diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h index 4ea45d0df1d4..5abff52d07fd 100644 --- a/include/linux/timekeeping32.h +++ b/include/linux/timekeeping32.h @@ -27,20 +27,11 @@ static inline int do_settimeofday(const struct timespec *ts) return do_settimeofday64(&ts64); } -static inline int __getnstimeofday(struct timespec *ts) -{ - struct timespec64 ts64; - int ret = __getnstimeofday64(&ts64); - - *ts = timespec64_to_timespec(ts64); - return ret; -} - static inline void getnstimeofday(struct timespec *ts) { struct timespec64 ts64; - getnstimeofday64(&ts64); + ktime_get_real_ts64(&ts64); *ts = timespec64_to_timespec(ts64); } @@ -56,7 +47,7 @@ static inline void ktime_get_real_ts(struct timespec *ts) { struct timespec64 ts64; - getnstimeofday64(&ts64); + ktime_get_real_ts64(&ts64); *ts = timespec64_to_timespec(ts64); } diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 49cbceef5deb..7bbc7a6e6095 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -705,18 +705,19 @@ static void timekeeping_forward_now(struct timekeeper *tk) } /** - * __getnstimeofday64 - Returns the time of day in a timespec64. + * ktime_get_real_ts64 - Returns the time of day in a timespec64. * @ts: pointer to the timespec to be set * - * Updates the time of day in the timespec. - * Returns 0 on success, or -ve when suspended (timespec will be undefined). + * Returns the time of day in a timespec64 (WARN if suspended). */ -int __getnstimeofday64(struct timespec64 *ts) +void ktime_get_real_ts64(struct timespec64 *ts) { struct timekeeper *tk = &tk_core.timekeeper; unsigned long seq; u64 nsecs; + WARN_ON(timekeeping_suspended); + do { seq = read_seqcount_begin(&tk_core.seq); @@ -727,28 +728,8 @@ int __getnstimeofday64(struct timespec64 *ts) ts->tv_nsec = 0; timespec64_add_ns(ts, nsecs); - - /* - * Do not bail out early, in case there were callers still using - * the value, even in the face of the WARN_ON. - */ - if (unlikely(timekeeping_suspended)) - return -EAGAIN; - return 0; -} -EXPORT_SYMBOL(__getnstimeofday64); - -/** - * getnstimeofday64 - Returns the time of day in a timespec64. - * @ts: pointer to the timespec64 to be set - * - * Returns the time of day in a timespec64 (WARN if suspended). - */ -void getnstimeofday64(struct timespec64 *ts) -{ - WARN_ON(__getnstimeofday64(ts)); } -EXPORT_SYMBOL(getnstimeofday64); +EXPORT_SYMBOL(ktime_get_real_ts64); ktime_t ktime_get(void) { -- 2.9.0
next prev parent reply other threads:[~2018-04-27 13:40 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-27 13:40 [PATCH 0/5] timekeeping: API cleanup and extensions Arnd Bergmann 2018-04-27 13:40 ` [PATCH 1/5] timekeeping: Remove timespec64 hack Arnd Bergmann 2018-04-27 20:16 ` Arnd Bergmann 2018-05-19 12:00 ` [tip:timers/2038] " tip-bot for Arnd Bergmann 2018-04-27 13:40 ` Arnd Bergmann [this message] 2018-05-19 12:01 ` [tip:timers/2038] timekeeping: Clean up ktime_get_real_ts64 tip-bot for Arnd Bergmann 2018-04-27 13:40 ` [PATCH 3/5] timekeeping: Standardize on ktime_get_*() naming Arnd Bergmann 2018-05-19 12:01 ` [tip:timers/2038] " tip-bot for Arnd Bergmann 2018-04-27 13:40 ` [PATCH 4/5] timekeeping: Add ktime_get_coarse_with_offset Arnd Bergmann 2018-05-19 12:02 ` [tip:timers/2038] " tip-bot for Arnd Bergmann 2018-04-27 13:40 ` [PATCH 5/5] timekeeping: Add more coarse clocktai/boottime interfaces Arnd Bergmann 2018-05-19 12:02 ` [tip:timers/2038] " tip-bot for Arnd Bergmann
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180427134016.2525989-3-arnd@arndb.de \ --to=arnd@arndb.de \ --cc=john.stultz@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=sboyd@kernel.org \ --cc=tglx@linutronix.de \ --cc=y2038@lists.linaro.org \ --subject='Re: [PATCH 2/5] timekeeping: Clean up ktime_get_real_ts64' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.