diff options
author | John Stultz <john.stultz@linaro.org> | 2013-03-22 12:28:15 -0700 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2013-04-04 13:18:15 -0700 |
commit | 87ace39b7168bd9d352c1c52b6f5d88eb1876cf8 (patch) | |
tree | 57f19306b0f2e9b99430f92a4ba9a7ac9454e2e0 /kernel/time/ntp.c | |
parent | e4085693f629ded8ac8c35b5cdd324d20242990b (diff) |
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>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 2dc60c6fe76..d17e13c0147 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -662,10 +662,8 @@ int ntp_validate_timex(struct timex *txc) * adjtimex mainly allows reading (and writing, if superuser) of * kernel time-keeping variables. used by xntpd. */ -int __do_adjtimex(struct timex *txc) +int __do_adjtimex(struct timex *txc, struct timespec *ts, s32 *time_tai) { - struct timespec ts; - u32 time_tai, orig_tai; int result; if (txc->modes & ADJ_SETOFFSET) { @@ -679,9 +677,6 @@ int __do_adjtimex(struct timex *txc) return result; } - getnstimeofday(&ts); - orig_tai = time_tai = timekeeping_get_tai_offset(); - raw_spin_lock_irq(&ntp_lock); if (txc->modes & ADJ_ADJTIME) { @@ -697,7 +692,7 @@ int __do_adjtimex(struct timex *txc) /* If there are input parameters, then process them: */ if (txc->modes) - process_adjtimex_modes(txc, &ts, &time_tai); + process_adjtimex_modes(txc, ts, time_tai); txc->offset = shift_right(time_offset * NTP_INTERVAL_FREQ, NTP_SCALE_SHIFT); @@ -719,18 +714,15 @@ int __do_adjtimex(struct timex *txc) txc->precision = 1; txc->tolerance = MAXFREQ_SCALED / PPM_SCALE; txc->tick = tick_usec; - txc->tai = time_tai; + txc->tai = *time_tai; /* fill PPS status fields */ pps_fill_timex(txc); raw_spin_unlock_irq(&ntp_lock); - if (time_tai != orig_tai) - timekeeping_set_tai_offset(time_tai); - - txc->time.tv_sec = ts.tv_sec; - txc->time.tv_usec = ts.tv_nsec; + txc->time.tv_sec = ts->tv_sec; + txc->time.tv_usec = ts->tv_nsec; if (!(time_status & STA_NANO)) txc->time.tv_usec /= NSEC_PER_USEC; |