summaryrefslogtreecommitdiffstats
path: root/kernel/time/timekeeping.c
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2013-03-22 15:04:13 -0700
committerJohn Stultz <john.stultz@linaro.org>2013-04-04 13:18:15 -0700
commitcef90377fab488bd1f959efda178fb83250cf61d (patch)
tree7ac4afc365ef3d35b339ac796d7ec921df618a58 /kernel/time/timekeeping.c
parent87ace39b7168bd9d352c1c52b6f5d88eb1876cf8 (diff)
downloadop-kernel-dev-cef90377fab488bd1f959efda178fb83250cf61d.zip
op-kernel-dev-cef90377fab488bd1f959efda178fb83250cf61d.tar.gz
timekeeping: Move ADJ_SETOFFSET to top level do_adjtimex()
Since ADJ_SETOFFSET adjusts the timekeeping state, process it as part of the top level do_adjtimex() function in timekeeping.c. This avoids deadlocks that could occur once we change the ntp locking rules. 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>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r--kernel/time/timekeeping.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5f7a233..e44915c 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1627,6 +1627,17 @@ int do_adjtimex(struct timex *txc)
if (ret)
return ret;
+ if (txc->modes & ADJ_SETOFFSET) {
+ struct timespec delta;
+ delta.tv_sec = txc->time.tv_sec;
+ delta.tv_nsec = txc->time.tv_usec;
+ if (!(txc->modes & ADJ_NANO))
+ delta.tv_nsec *= 1000;
+ ret = timekeeping_inject_offset(&delta);
+ if (ret)
+ return ret;
+ }
+
getnstimeofday(&ts);
orig_tai = tai = timekeeping_get_tai_offset();
OpenPOWER on IntegriCloud