mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xunlei Pang <xlpang@126.com>
To: linux-kernel@vger.kernel.org,
	John Stultz <john.stultz@linaro.org>,
	Arnd Bergmann <arnd.bergmann@linaro.org>
Cc: rtc-linux@googlegroups.com, Thomas Gleixner <tglx@linutronix.de>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Xunlei Pang <pang.xunlei@linaro.org>
Subject: [RFC PATCH v2 2/9] time: Provide y2106 safe get_seconds() replacement
Date: Tue, 13 Jan 2015 23:44:50 +0800	[thread overview]
Message-ID: <1421163897-8020-3-git-send-email-xlpang@126.com> (raw)
In-Reply-To: <1421163897-8020-1-git-send-email-xlpang@126.com>

From: Xunlei Pang <pang.xunlei@linaro.org>

As part of addressing "y2038 problem" for in-kernel uses, this
patch adds safe get_seconds64() using time64_t.

After this patch, get_seconds() is deprecated and all its call sites
will be fixed using get_seconds64(), after that it can be removed.

Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 include/linux/timekeeping.h | 10 +++++++++-
 kernel/time/timekeeping.c   |  4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 9b63d13..384d101 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -17,7 +17,7 @@ extern int do_sys_settimeofday(const struct timespec *tv,
 /*
  * Kernel time accessors
  */
-unsigned long get_seconds(void);
+extern time64_t get_seconds64(void);
 struct timespec current_kernel_time(void);
 /* does not take xtime_lock */
 struct timespec __current_kernel_time(void);
@@ -34,6 +34,14 @@ extern time64_t ktime_get_real_seconds(void);
 extern int __getnstimeofday64(struct timespec64 *tv);
 extern void getnstimeofday64(struct timespec64 *tv);
 
+/**
+ * Deprecated. Use get_seconds64().
+ */
+static inline unsigned long get_seconds(void)
+{
+	return (unsigned long)get_seconds64();
+}
+
 #if BITS_PER_LONG == 64
 /**
  * Deprecated. Use do_settimeofday64().
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 6a93185..ab021a3 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1678,13 +1678,13 @@ void getboottime(struct timespec *ts)
 }
 EXPORT_SYMBOL_GPL(getboottime);
 
-unsigned long get_seconds(void)
+time64_t get_seconds64(void)
 {
 	struct timekeeper *tk = &tk_core.timekeeper;
 
 	return tk->xtime_sec;
 }
-EXPORT_SYMBOL(get_seconds);
+EXPORT_SYMBOL(get_seconds64);
 
 struct timespec __current_kernel_time(void)
 {
-- 
1.9.1



  parent reply	other threads:[~2015-01-13 15:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 15:44 [RFC PATCH v2 0/9] Provide y2038/y2106 safe rtc_class_ops.set_mmss64() Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 1/9] rtc: Provide y2038 safe rtc_class_ops.set_mmss() replacement Xunlei Pang
2015-01-13 16:12   ` Alessandro Zummo
2015-01-13 15:44 ` Xunlei Pang [this message]
2015-01-13 16:17   ` [RFC PATCH v2 2/9] time: Provide y2106 safe get_seconds() replacement Alessandro Zummo
2015-01-13 20:34     ` Arnd Bergmann
2015-01-13 20:42   ` Thomas Gleixner
2015-01-14 14:52     ` Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues Xunlei Pang
2015-01-13 16:19   ` Alessandro Zummo
2015-01-14 14:56     ` Xunlei Pang
2015-01-14 15:03       ` Alessandro Zummo
2015-01-14 15:26         ` Xunlei Pang
2015-01-14 15:39           ` Alessandro Zummo
2015-01-16 15:40             ` Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 4/9] rtc/ab3100: " Xunlei Pang
2015-01-13 16:20   ` Alessandro Zummo
2015-01-15 17:23   ` Linus Walleij
2015-01-13 15:44 ` [RFC PATCH v2 5/9] rtc/mc13xxx: " Xunlei Pang
2015-01-14 15:07   ` Xunlei Pang
2015-01-14 17:03     ` Uwe Kleine-König
2015-01-13 15:44 ` [RFC PATCH v2 6/9] rtc/mxc: Modify rtc_update_alarm() not to touch the alarm time Xunlei Pang
2015-01-13 16:23   ` Alessandro Zummo
2015-01-14 15:13   ` Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 7/9] rtc/mxc: Convert get_alarm_or_time()/set_alarm_or_time() to use time64_t Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 8/9] rtc/mxc: Update driver to address y2038/y2106 issues Xunlei Pang
2015-01-13 15:44 ` [RFC PATCH v2 9/9] alpha: change to use rtc_class_ops's set_mmss64() Xunlei Pang

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=1421163897-8020-3-git-send-email-xlpang@126.com \
    --to=xlpang@126.com \
    --cc=a.zummo@towertech.it \
    --cc=arnd.bergmann@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pang.xunlei@linaro.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=tglx@linutronix.de \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®