All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/8] ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacement
@ 2015-03-11  3:24 Xunlei Pang
  2015-03-11  3:24 ` [PATCH 6/8] ARM: time: Provide read_boot_clock64() and read_persistent_clock64() Xunlei Pang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Xunlei Pang @ 2015-03-11  3:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: rtc-linux, Thomas Gleixner, Alessandro Zummo, John Stultz,
	Arnd Bergmann, linux-omap, Tony Lindgren, linux-tegra,
	Stephen Warren, linux390, Martin Schwidefsky, Ralf Baechle,
	Arnd Bergmann, Xunlei Pang

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

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 <pang.xunlei@linaro.org>
---
 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 d2616ef..7fc7fb9 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)
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-11  8:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11  3:24 [PATCH 5/8] ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacement Xunlei Pang
2015-03-11  3:24 ` [PATCH 6/8] ARM: time: Provide read_boot_clock64() and read_persistent_clock64() Xunlei Pang
2015-03-11  8:53   ` Thierry Reding
     [not found] ` <1426044277-22170-1-git-send-email-xlpang-KN7UnAbNpbg@public.gmane.org>
2015-03-11  3:24   ` [PATCH 7/8] s390: " Xunlei Pang
2015-03-11  3:24     ` Xunlei Pang
2015-03-11  3:24 ` [PATCH 8/8] time: Remove read_boot_clock() Xunlei Pang
2015-03-11  8:52 ` [PATCH 5/8] ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacement Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.