From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752753AbbDCIRZ (ORCPT ); Fri, 3 Apr 2015 04:17:25 -0400 Received: from terminus.zytor.com ([198.137.202.10]:44607 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752626AbbDCIRW (ORCPT ); Fri, 3 Apr 2015 04:17:22 -0400 Date: Fri, 3 Apr 2015 01:16:48 -0700 From: tip-bot for Xunlei Pang Message-ID: Cc: hpa@zytor.com, peterz@infradead.org, mingo@kernel.org, pang.xunlei@linaro.org, tglx@linutronix.de, john.stultz@linaro.org, treding@nvidia.com, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, john.stultz@linaro.org, treding@nvidia.com, tglx@linutronix.de, pang.xunlei@linaro.org, peterz@infradead.org, mingo@kernel.org, hpa@zytor.com In-Reply-To: <1427945681-29972-6-git-send-email-john.stultz@linaro.org> References: <1427945681-29972-6-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] clocksource/drivers/tegra: Provide y2038-safe tegra_read_persistent_clock() replacement Git-Commit-ID: a0c2998f918e7e597d3c686c5f3d5a30d0382dd6 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a0c2998f918e7e597d3c686c5f3d5a30d0382dd6 Gitweb: http://git.kernel.org/tip/a0c2998f918e7e597d3c686c5f3d5a30d0382dd6 Author: Xunlei Pang AuthorDate: Wed, 1 Apr 2015 20:34:25 -0700 Committer: Ingo Molnar CommitDate: Fri, 3 Apr 2015 08:18:22 +0200 clocksource/drivers/tegra: Provide y2038-safe tegra_read_persistent_clock() replacement As part of addressing "y2038 problem" for in-kernel uses, this patch adds the y2038-safe tegra_read_persistent_clock64() using timespec64. Because we rely on some subsequent changes to convert arm multiarch support, tegra_read_persistent_clock() will be removed then. Signed-off-by: Xunlei Pang Signed-off-by: John Stultz Acked-by: Thierry Reding Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1427945681-29972-6-git-send-email-john.stultz@linaro.org Signed-off-by: Ingo Molnar --- drivers/clocksource/tegra20_timer.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c index d8a3a4e..4a0a603 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c @@ -51,7 +51,7 @@ static void __iomem *timer_reg_base; static void __iomem *rtc_base; -static struct timespec persistent_ts; +static struct timespec64 persistent_ts; static u64 persistent_ms, last_persistent_ms; static struct delay_timer tegra_delay_timer; @@ -120,26 +120,33 @@ static u64 tegra_rtc_read_ms(void) } /* - * tegra_read_persistent_clock - Return time from a persistent clock. + * tegra_read_persistent_clock64 - Return time from a persistent clock. * * Reads the time from a source which isn't disabled during PM, the * 32k sync timer. Convert the cycles elapsed since last read into - * nsecs and adds to a monotonically increasing timespec. + * nsecs and adds to a monotonically increasing timespec64. * Care must be taken that this funciton is not called while the * tegra_rtc driver could be executing to avoid race conditions * on the RTC shadow register */ -static void tegra_read_persistent_clock(struct timespec *ts) +static void tegra_read_persistent_clock64(struct timespec64 *ts) { u64 delta; - struct timespec *tsp = &persistent_ts; last_persistent_ms = persistent_ms; persistent_ms = tegra_rtc_read_ms(); delta = persistent_ms - last_persistent_ms; - timespec_add_ns(tsp, delta * NSEC_PER_MSEC); - *ts = *tsp; + timespec64_add_ns(&persistent_ts, delta * NSEC_PER_MSEC); + *ts = persistent_ts; +} + +static void tegra_read_persistent_clock(struct timespec *ts) +{ + struct timespec ts64; + + tegra_read_persistent_clock64(&ts64); + *ts = timespec64_to_timespec(ts64); } static unsigned long tegra_delay_timer_read_counter_long(void)