From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbbDCIRL (ORCPT ); Fri, 3 Apr 2015 04:17:11 -0400 Received: from terminus.zytor.com ([198.137.202.10]:44594 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752626AbbDCIRG (ORCPT ); Fri, 3 Apr 2015 04:17:06 -0400 Date: Fri, 3 Apr 2015 01:16:32 -0700 From: tip-bot for Xunlei Pang Message-ID: Cc: tglx@linutronix.de, mingo@kernel.org, pang.xunlei@linaro.org, tony@atomide.com, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, john.stultz@linaro.org Reply-To: tony@atomide.com, john.stultz@linaro.org, peterz@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@kernel.org, tglx@linutronix.de, pang.xunlei@linaro.org In-Reply-To: <1427945681-29972-5-git-send-email-john.stultz@linaro.org> References: <1427945681-29972-5-git-send-email-john.stultz@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] ARM: OMAP: 32k counter: Provide y2038-safe omap_read_persistent_clock() replacement Git-Commit-ID: a451570c008b9e19592e29f15cfd295bdf818c7a 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: a451570c008b9e19592e29f15cfd295bdf818c7a Gitweb: http://git.kernel.org/tip/a451570c008b9e19592e29f15cfd295bdf818c7a Author: Xunlei Pang AuthorDate: Wed, 1 Apr 2015 20:34:24 -0700 Committer: Ingo Molnar CommitDate: Fri, 3 Apr 2015 08:18:21 +0200 ARM: OMAP: 32k counter: Provide y2038-safe omap_read_persistent_clock() replacement As part of addressing "y2038 problem" for in-kernel uses, this patch adds the y2038-safe omap_read_persistent_clock64() using timespec64. Because we rely on some subsequent changes to convert arm multiarch support, omap_read_persistent_clock() will be removed then. Also remove the needless spinlock, because read_persistent_clock() doesn't run simultaneously. Signed-off-by: Xunlei Pang Signed-off-by: John Stultz Acked-by: Tony Lindgren Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1427945681-29972-5-git-send-email-john.stultz@linaro.org Signed-off-by: Ingo Molnar --- arch/arm/plat-omap/counter_32k.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c index 43cf745..b7b7b07 100644 --- a/arch/arm/plat-omap/counter_32k.c +++ b/arch/arm/plat-omap/counter_32k.c @@ -44,24 +44,20 @@ static u64 notrace omap_32k_read_sched_clock(void) } /** - * omap_read_persistent_clock - Return time from a persistent clock. + * omap_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. */ -static struct timespec persistent_ts; +static struct timespec64 persistent_ts; static cycles_t cycles; static unsigned int persistent_mult, persistent_shift; -static DEFINE_SPINLOCK(read_persistent_clock_lock); -static void omap_read_persistent_clock(struct timespec *ts) +static void omap_read_persistent_clock64(struct timespec64 *ts) { unsigned long long nsecs; cycles_t last_cycles; - unsigned long flags; - - spin_lock_irqsave(&read_persistent_clock_lock, flags); last_cycles = cycles; cycles = sync32k_cnt_reg ? readl_relaxed(sync32k_cnt_reg) : 0; @@ -69,11 +65,17 @@ static void omap_read_persistent_clock(struct timespec *ts) nsecs = clocksource_cyc2ns(cycles - last_cycles, persistent_mult, persistent_shift); - timespec_add_ns(&persistent_ts, nsecs); + timespec64_add_ns(&persistent_ts, nsecs); *ts = persistent_ts; +} + +static void omap_read_persistent_clock(struct timespec *ts) +{ + struct timespec64 ts64; - spin_unlock_irqrestore(&read_persistent_clock_lock, flags); + omap_read_persistent_clock64(&ts64); + *ts = timespec64_to_timespec(ts64); } /**