diff mbox

[3/4] time: Expose timekeeping_inject_sleeptime64() to in-kernel users

Message ID 1415420775-4987-3-git-send-email-john.stultz@linaro.org
State New
Headers show

Commit Message

John Stultz Nov. 8, 2014, 4:26 a.m. UTC
Adds a timekeeping_inject_sleeptime64() interface to allow
us to replace existing timekeeping_inject_sleeptime() users
as we cleanup timespec usage in the kernel.

Cc: Arnd Bergmann <arnd.bergmann@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 include/linux/timekeeping.h | 18 +++++++++++++++++-
 kernel/time/timekeeping.c   | 10 ++++------
 2 files changed, 21 insertions(+), 7 deletions(-)
diff mbox

Patch

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b94db3c..96e11e2 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -204,7 +204,23 @@  static inline void timekeeping_clocktai(struct timespec *ts)
 /*
  * RTC specific
  */
-extern void timekeeping_inject_sleeptime(struct timespec *delta);
+extern void timekeeping_inject_sleeptime64(struct timespec64 *delta);
+
+#if BITS_PER_LONG == 64
+static inline void timekeeping_inject_sleeptime(struct timespec *delta)
+{
+	timekeeping_inject_sleeptime64(delta);
+}
+#else
+static inline void timekeeping_inject_sleeptime(struct timespec *delta)
+{
+	struct timespec64 ts;
+
+	ts = timespec_to_timespec64(*delta);
+	timekeeping_inject_sleeptime64(&ts);
+}
+#endif
+
 
 /*
  * PPS accessor
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 653d251..9491a58 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1069,8 +1069,8 @@  static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
 }
 
 /**
- * timekeeping_inject_sleeptime - Adds suspend interval to timeekeeping values
- * @delta: pointer to a timespec delta value
+ * timekeeping_inject_sleeptime64 - Adds suspend interval to timeekeeping values
+ * @delta: pointer to a timespec64 delta value
  *
  * This hook is for architectures that cannot support read_persistent_clock
  * because their RTC/persistent clock is only accessible when irqs are enabled.
@@ -1078,10 +1078,9 @@  static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
  * This function should only be called by rtc_resume(), and allows
  * a suspend offset to be injected into the timekeeping values.
  */
-void timekeeping_inject_sleeptime(struct timespec *delta)
+void timekeeping_inject_sleeptime64(struct timespec64 *delta)
 {
 	struct timekeeper *tk = &tk_core.timekeeper;
-	struct timespec64 tmp;
 	unsigned long flags;
 
 	/*
@@ -1096,8 +1095,7 @@  void timekeeping_inject_sleeptime(struct timespec *delta)
 
 	timekeeping_forward_now(tk);
 
-	tmp = timespec_to_timespec64(*delta);
-	__timekeeping_inject_sleeptime(tk, &tmp);
+	__timekeeping_inject_sleeptime(tk, delta);
 
 	timekeeping_update(tk, TK_CLEAR_NTP | TK_MIRROR | TK_CLOCK_WAS_SET);