From patchwork Thu Oct 19 11:14:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 116365 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp366553qgn; Thu, 19 Oct 2017 04:16:08 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SzcEe/VjRDNjtvQdV6iwOm8ZNOoaXdfPqM8AO3Ty2HVun9exh+Pi5ddQV4Ay3kWWcwYjL1 X-Received: by 10.99.115.79 with SMTP id d15mr1045247pgn.343.1508411768468; Thu, 19 Oct 2017 04:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508411768; cv=none; d=google.com; s=arc-20160816; b=wCMIloCIGC7+Vzve+LYQwtKQ6ZTHuGZ/axI0T+LWmUPPfqLWtsIdstWOQ8WlNnKcbh piYFl9LCSnlX64C5Vyxho0hIFNgG2u6OcB8987I921+laYv8a9o5hFFLi7PXBk7aES24 qON7JquXJS2Mf/FW2IIp6bVo1zWfEf6y8kJSbPf73gWBBA+wJtjlw6Z4hINUevI1Hy6B daXoYLL5zXkpp6fi4c10kLYilBd+lCCGEmxM6kJiqtIsbjCshX7SPc0y8dbaSiUNsEiQ dsvQCuNOGX6lSniKhGmYXnq0YlIBZRhWd7uzyO4dwVOJb5LkbfVUGk2UbLpUe7vfbiyv TrZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3aJ+z96OK247rU9zFo25foUPgT/3iD4I25pJOjTM700=; b=n80OcHrK1UosFXzqp849XwpZWc8PZa3KNQqJthFxw/j+kCXd0AKDAhLU1WO1rvWK0R 4F1DlJDTUod1XN0zLfsiLatoQ7/xUduwPpnRbwbd10uPoeadUnxB/KBwVRpFxNZxccoq z22QiESeBx6c1A6flbn5FmYH0kVrpuvaxVMVoFEU8C1SQMA2H5nplv+w46GGg6pXKwAu TOaUG0/rSLqpMuqw3gDKrN1smjpRA3BA6IPunE7Icj0DaB/0X/6v+xqv6c3b/lCbuZw9 h/7oN5rBt6egFS8Vzo8+OUGrrdSqFlT0YJMB9RiotypfHZELTjzb6+9A32y/wyJsnxxK HhYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v63si8364594pgv.8.2017.10.19.04.16.08; Thu, 19 Oct 2017 04:16:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbdJSLPl (ORCPT + 27 others); Thu, 19 Oct 2017 07:15:41 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:60344 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670AbdJSLPQ (ORCPT ); Thu, 19 Oct 2017 07:15:16 -0400 Received: from wuerfel.lan ([46.223.139.202]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MPGl6-1e9YdN360G-004Q2v; Thu, 19 Oct 2017 13:15:05 +0200 From: Arnd Bergmann To: Thomas Gleixner , y2038@lists.linaro.org Cc: Deepa Dinamani , John Stultz , Stephen Boyd , linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [PATCH 6/7] time: move old timekeeping interfaces to timekeeping32.h Date: Thu, 19 Oct 2017 13:14:49 +0200 Message-Id: <20171019111450.3702205-6-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171019111450.3702205-1-arnd@arndb.de> References: <20171019111450.3702205-1-arnd@arndb.de> X-Provags-ID: V03:K0:YhrK+s8YhUz+uEhGbtYywjvGkhH3OMbycTSCP2+7p0o37kxR+eN Zqse/FWftFRi2mQ67vY5bw2yXoegNtexzefUwM5HQVnimNKHDVjuUR10fi+6EtdbeO3GnJD InxJYzEhd++by6zfPk33NMsbeds180o7zAvdXFV9TY1GmWwyXl8aoMJ306HhucL8/XKDcuV 9fVOV+pCc9Nji8SPCXPAA== X-UI-Out-Filterresults: notjunk:1; V01:K0:38FiVUI6FxQ=:4zv2KbQI+y851Y19XZ/DJm nPzYhCgKXLlAXEAA7hspfkmda83kuIz92Xq4ZgHp+TfTytfpZ0XOEZTpzHIyMKWwV/z2Srsnu x27f1EG14mEgPl0Y2Xmrh1QWQu8j1CUM/YdZ7EMltKV6QozxGc/Hf6nEO//gDMj+AylRo2lVW KbFo23Nz5FpixlK0PAtHBQsxFwqH9gzwn/VxMSSKOc72zwmevpBvZXs74vmmtXjCbDPmmq+bf mw7f+KgrPj3JhlWw8jVxoeAI7phdspHFBNeA4lFZKkbT6C4qGvLYZ+twkvnGcLZiD7QMbmLUy HPSQBUUn+MwUAlc2Rfd2sihb85LVNwwL4iU//+9HRhgtew3kPcF6vWUsnt8PYQMistRYTFWB0 /vfFeaz8AdEQGiz9edoPnide4SWh0Dwo24KgohGNMFlrpqAN+AzWQ566S71pypMRme60lJiOC GprGJkNiz4pIHy92inGkIK4tcVmrMEySGXbhJIxhAWXbtRKN9ZoMDrBtB1l8XSKIxFd0Kl964 TkhXGhgULS9xyncK0Mei2Eo0g9vbMz0hxHWVqn3/WKEAOQlj79Iopx4eJg0D5INP83dQgvruX ha6mEKSHHyG2W/7qPZfa7RR19AaHUHCujeVvyspfIIAnI5VYkMECRvZ7YTBJYqvQNCE16QUyi ME3z1JJxINb+LllU0/0e1LcnmjOXwbpF5Gs7GStcqGkg0Q+7XzGoTozie+RKFNv6X8MxSsRCN ai/UC3T2Gcq7+wuu/GTCdSDtjIZ4oybhEJc8VA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The interfaces based on 'struct timespec' and 'unsigned long' seconds are no longer recommended for new code, and we are trying to migrate to ktime_t based interfaces and other y2038-safe variants. This moves all the legacy interfaces from linux/timekeeping.h into a new timekeeping32.h to better document this. Signed-off-by: Arnd Bergmann --- include/linux/ktime.h | 1 + include/linux/timekeeping.h | 137 +------------------------------------- include/linux/timekeeping32.h | 151 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 135 deletions(-) create mode 100644 include/linux/timekeeping32.h -- 2.9.0 diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 0c8bd45c8206..5b9fddbaac41 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -270,5 +270,6 @@ static inline ktime_t ms_to_ktime(u64 ms) } # include +# include #endif diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index eb98cbdbb323..2263698edeaf 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -15,27 +15,16 @@ extern void xtime_update(unsigned long ticks); /* * Get and set timeofday */ -extern void do_gettimeofday(struct timeval *tv); extern int do_settimeofday64(const struct timespec64 *ts); extern int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz); /* * Kernel time accessors */ -unsigned long get_seconds(void); struct timespec64 current_kernel_time64(void); -/* does not take xtime_lock */ -struct timespec __current_kernel_time(void); - -static inline struct timespec current_kernel_time(void) -{ - struct timespec64 now = current_kernel_time64(); - - return timespec64_to_timespec(now); -} /* - * timespec based interfaces + * timespec64 based interfaces */ struct timespec64 get_monotonic_coarse64(void); extern void getrawmonotonic64(struct timespec64 *ts); @@ -47,116 +36,6 @@ extern int __getnstimeofday64(struct timespec64 *tv); extern void getnstimeofday64(struct timespec64 *tv); extern void getboottime64(struct timespec64 *ts); -#if BITS_PER_LONG == 64 -/** - * Deprecated. Use do_settimeofday64(). - */ -static inline int do_settimeofday(const struct timespec *ts) -{ - return do_settimeofday64(ts); -} - -static inline int __getnstimeofday(struct timespec *ts) -{ - return __getnstimeofday64(ts); -} - -static inline void getnstimeofday(struct timespec *ts) -{ - getnstimeofday64(ts); -} - -static inline void ktime_get_ts(struct timespec *ts) -{ - ktime_get_ts64(ts); -} - -static inline void ktime_get_real_ts(struct timespec *ts) -{ - getnstimeofday64(ts); -} - -static inline void getrawmonotonic(struct timespec *ts) -{ - getrawmonotonic64(ts); -} - -static inline struct timespec get_monotonic_coarse(void) -{ - return get_monotonic_coarse64(); -} - -static inline void getboottime(struct timespec *ts) -{ - return getboottime64(ts); -} -#else -/** - * Deprecated. Use do_settimeofday64(). - */ -static inline int do_settimeofday(const struct timespec *ts) -{ - struct timespec64 ts64; - - ts64 = timespec_to_timespec64(*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); - *ts = timespec64_to_timespec(ts64); -} - -static inline void ktime_get_ts(struct timespec *ts) -{ - struct timespec64 ts64; - - ktime_get_ts64(&ts64); - *ts = timespec64_to_timespec(ts64); -} - -static inline void ktime_get_real_ts(struct timespec *ts) -{ - struct timespec64 ts64; - - getnstimeofday64(&ts64); - *ts = timespec64_to_timespec(ts64); -} - -static inline void getrawmonotonic(struct timespec *ts) -{ - struct timespec64 ts64; - - getrawmonotonic64(&ts64); - *ts = timespec64_to_timespec(ts64); -} - -static inline struct timespec get_monotonic_coarse(void) -{ - return timespec64_to_timespec(get_monotonic_coarse64()); -} - -static inline void getboottime(struct timespec *ts) -{ - struct timespec64 ts64; - - getboottime64(&ts64); - *ts = timespec64_to_timespec(ts64); -} -#endif - #define ktime_get_real_ts64(ts) getnstimeofday64(ts) /* @@ -242,23 +121,13 @@ extern u64 ktime_get_boot_fast_ns(void); extern u64 ktime_get_real_fast_ns(void); /* - * Timespec interfaces utilizing the ktime based ones + * timespec64 interfaces utilizing the ktime based ones */ -static inline void get_monotonic_boottime(struct timespec *ts) -{ - *ts = ktime_to_timespec(ktime_get_boottime()); -} - static inline void get_monotonic_boottime64(struct timespec64 *ts) { *ts = ktime_to_timespec64(ktime_get_boottime()); } -static inline void timekeeping_clocktai(struct timespec *ts) -{ - *ts = ktime_to_timespec(ktime_get_clocktai()); -} - static inline void timekeeping_clocktai64(struct timespec64 *ts) { *ts = ktime_to_timespec64(ktime_get_clocktai()); @@ -341,10 +210,8 @@ extern void ktime_get_snapshot(struct system_time_snapshot *systime_snapshot); */ extern int persistent_clock_is_local; -extern void read_persistent_clock(struct timespec *ts); extern void read_persistent_clock64(struct timespec64 *ts); extern void read_boot_clock64(struct timespec64 *ts); -extern int update_persistent_clock(struct timespec now); extern int update_persistent_clock64(struct timespec64 now); diff --git a/include/linux/timekeeping32.h b/include/linux/timekeeping32.h new file mode 100644 index 000000000000..af4114d5dc17 --- /dev/null +++ b/include/linux/timekeeping32.h @@ -0,0 +1,151 @@ +#ifndef _LINUX_TIMEKEEPING32_H +#define _LINUX_TIMEKEEPING32_H +/* + * These interfaces are all based on the old timespec type + * and should get replaced with the timespec64 based versions + * over time so we can remove the file here. + */ + +extern void do_gettimeofday(struct timeval *tv); +unsigned long get_seconds(void); + +/* does not take xtime_lock */ +struct timespec __current_kernel_time(void); + +static inline struct timespec current_kernel_time(void) +{ + struct timespec64 now = current_kernel_time64(); + + return timespec64_to_timespec(now); +} + +#if BITS_PER_LONG == 64 +/** + * Deprecated. Use do_settimeofday64(). + */ +static inline int do_settimeofday(const struct timespec *ts) +{ + return do_settimeofday64(ts); +} + +static inline int __getnstimeofday(struct timespec *ts) +{ + return __getnstimeofday64(ts); +} + +static inline void getnstimeofday(struct timespec *ts) +{ + getnstimeofday64(ts); +} + +static inline void ktime_get_ts(struct timespec *ts) +{ + ktime_get_ts64(ts); +} + +static inline void ktime_get_real_ts(struct timespec *ts) +{ + getnstimeofday64(ts); +} + +static inline void getrawmonotonic(struct timespec *ts) +{ + getrawmonotonic64(ts); +} + +static inline struct timespec get_monotonic_coarse(void) +{ + return get_monotonic_coarse64(); +} + +static inline void getboottime(struct timespec *ts) +{ + return getboottime64(ts); +} +#else +/** + * Deprecated. Use do_settimeofday64(). + */ +static inline int do_settimeofday(const struct timespec *ts) +{ + struct timespec64 ts64; + + ts64 = timespec_to_timespec64(*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); + *ts = timespec64_to_timespec(ts64); +} + +static inline void ktime_get_ts(struct timespec *ts) +{ + struct timespec64 ts64; + + ktime_get_ts64(&ts64); + *ts = timespec64_to_timespec(ts64); +} + +static inline void ktime_get_real_ts(struct timespec *ts) +{ + struct timespec64 ts64; + + getnstimeofday64(&ts64); + *ts = timespec64_to_timespec(ts64); +} + +static inline void getrawmonotonic(struct timespec *ts) +{ + struct timespec64 ts64; + + getrawmonotonic64(&ts64); + *ts = timespec64_to_timespec(ts64); +} + +static inline struct timespec get_monotonic_coarse(void) +{ + return timespec64_to_timespec(get_monotonic_coarse64()); +} + +static inline void getboottime(struct timespec *ts) +{ + struct timespec64 ts64; + + getboottime64(&ts64); + *ts = timespec64_to_timespec(ts64); +} +#endif + +/* + * Timespec interfaces utilizing the ktime based ones + */ +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()); +} + +/* + * Persistent clock related interfaces + */ +extern void read_persistent_clock(struct timespec *ts); +extern int update_persistent_clock(struct timespec now); + +#endif