Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1192456

[PATCH v2 2/2] mn10300: time: Provide 64-bit persistent clock time

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Xunlei Pang <xlpang@126.com>
Newsgroups linux.kernel
Subject [PATCH v2 2/2] mn10300: time: Provide 64-bit persistent clock time
Date Sun, 26 Jul 2015 04:00:01 +0200
Message-ID <pQjol-5ui-3@gated-at.bofh.it> (permalink)
References <pQjol-5ui-5@gated-at.bofh.it>
X-Original-To linux-kernel@vger.kernel.org
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=4R4lZ9BSd8HtHzOojk BYbNlaqL049cSoQQ+tMdL4DQI=; b=Ohbx0+aWP7JOkUpSz8fNSLMmmWwIlm5GbV 797hHxtBMIQmnzcVqecm4oRHpN35RSb3qklzZ2PWSEXOSaaFzvBPeO2at1n0XNnq UPOWcS0jQrWC00ONQJemgAfZpwJGQnUE2jFqIGGQdmte3H+vy0ZNp7Ujhy8K9GDh MbagYOLKI=
X-Mailer git-send-email 1.9.1
X-Cm-Transid jdKowAAHrCTXPbRVwMbaAQ--.5958S4
X-Coremail-Antispam 1Uf129KBjvJXoW7CryDZw47tr18ZF1UXr15XFb_yoW8Kr45p3 yIk3Z8Jr4UtFW7ZF92y34Duw1Yg3s8tF42qa4fta4Fywn7trnrKFy0v342vr9FgFyfZa10 9a1xGFnIvw4kCwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jJqXdUUUUU=
X-Originating-IP [210.21.223.3]
X-Cm-Senderinfo p0ost0bj6rjloofrz/1tbi7wBDv1UwzFDCfgAAsW
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 78
Organization linux.* mail to news gateway
X-Original-Cc Thomas Gleixner <tglx@linutronix.de>, David Howells <dhowells@redhat.com>, Koichi Yasutake <yasutake.koichi@jp.panasonic.com>, linux-am33-list@redhat.com, Xunlei Pang <pang.xunlei@linaro.org>, John Stultz <john.stultz@linaro.org>, Arnd Bergmann <arnd@arndb.de>
X-Original-Date Sun, 26 Jul 2015 09:53:53 +0800
X-Original-Message-ID <1437875633-5715-2-git-send-email-xlpang@126.com>
X-Original-References <1437875633-5715-1-git-send-email-xlpang@126.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1192456

Show key headers only | View raw


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

As part of addressing the "y2038 problem" for in-kernel uses,
convert update_persistent_clock() to update_persistent_clock64(),
read_persistent_clock() to read_persistent_clock64() using
timespec64 for MN10300.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 arch/mn10300/kernel/rtc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/mn10300/kernel/rtc.c b/arch/mn10300/kernel/rtc.c
index 48d7058..038ae16 100644
--- a/arch/mn10300/kernel/rtc.c
+++ b/arch/mn10300/kernel/rtc.c
@@ -23,19 +23,19 @@ EXPORT_SYMBOL(rtc_lock);
 /*
  * Read the current RTC time
  */
-void read_persistent_clock(struct timespec *ts)
+void read_persistent_clock64(struct timespec64 *ts)
 {
 	struct rtc_time tm;
 
 	get_rtc_time(&tm);
 
 	ts->tv_nsec = 0;
-	ts->tv_sec = mktime(tm.tm_year, tm.tm_mon, tm.tm_mday,
+	ts->tv_sec = mktime64(tm.tm_year, tm.tm_mon, tm.tm_mday,
 			    tm.tm_hour, tm.tm_min, tm.tm_sec);
 
 	/* if rtc is way off in the past, set something reasonable */
 	if (ts->tv_sec < 0)
-		ts->tv_sec = mktime(2009, 1, 1, 12, 0, 0);
+		ts->tv_sec = mktime64(2009, 1, 1, 12, 0, 0);
 }
 
 /*
@@ -48,7 +48,7 @@ void read_persistent_clock(struct timespec *ts)
  * BUG: This routine does not handle hour overflow properly; it just
  *      sets the minutes. Usually you'll only notice that after reboot!
  */
-static int set_rtc_mmss(unsigned long nowtime)
+static int set_rtc_mmss(time64_t nowtime)
 {
 	unsigned char save_control, save_freq_select;
 	int retval = 0;
@@ -74,8 +74,7 @@ static int set_rtc_mmss(unsigned long nowtime)
 	 * messing with unknown time zones but requires your
 	 * RTC not to be off by more than 15 minutes
 	 */
-	real_seconds = nowtime % 60;
-	real_minutes = nowtime / 60;
+	real_minutes = div_s64_rem(nowtime, 60, &real_seconds);
 	if (((abs(real_minutes - cmos_minutes) + 15) / 30) & 1)
 		/* correct for half hour time zone */
 		real_minutes += 30;
@@ -109,7 +108,7 @@ static int set_rtc_mmss(unsigned long nowtime)
 	return retval;
 }
 
-int update_persistent_clock(struct timespec now)
+int update_persistent_clock64(struct timespec64 now)
 {
 	return set_rtc_mmss(now.tv_sec);
 }
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] time: Add the common weak version of update_persistent_clock() Xunlei Pang <xlpang@126.com> - 2015-07-26 04:00 +0200
  [PATCH v2 2/2] mn10300: time: Provide 64-bit persistent clock time Xunlei Pang <xlpang@126.com> - 2015-07-26 04:00 +0200

csiph-web