ntp: Rework do_adjtimex to take timespec and tai arguments
In order to change the locking rules, we need to provide
the timespec and tai values rather then having the ntp
logic acquire these values itself.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index f6c8a72..5f7a233 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1618,6 +1618,8 @@
*/
int do_adjtimex(struct timex *txc)
{
+ struct timespec ts;
+ s32 tai, orig_tai;
int ret;
/* Validate the data before disabling interrupts */
@@ -1625,9 +1627,16 @@
if (ret)
return ret;
- return __do_adjtimex(txc);
-}
+ getnstimeofday(&ts);
+ orig_tai = tai = timekeeping_get_tai_offset();
+ ret = __do_adjtimex(txc, &ts, &tai);
+
+ if (tai != orig_tai)
+ timekeeping_set_tai_offset(tai);
+
+ return ret;
+}
#ifdef CONFIG_NTP_PPS
/**