[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1293493244-17583-4-git-send-email-john.stultz@linaro.org>
Date: Mon, 27 Dec 2010 15:40:44 -0800
From: John Stultz <john.stultz@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: John Stultz <john.stultz@...aro.org>,
Richard Cochran <richard.cochran@...cron.at>,
Thomas Gleixner <tglx@...utronix.de>
Subject: [PATCH 3/3] ntp: Change ADJ_SETOFFSET implementation to use timekeeping_inject_offset
Cleans up the ADJ_SETOFFSET implementation to use
timekeeping_inject_offset which greatly simplifies the code.
CC: Richard Cochran <richard.cochran@...cron.at>
CC: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
kernel/time/ntp.c | 25 ++++++-------------------
1 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index e9e3915..18d7a0f 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -454,7 +454,6 @@ static inline void process_adjtimex_modes(struct timex *txc, struct timespec *ts
int do_adjtimex(struct timex *txc)
{
struct timespec ts;
- ktime_t delta, kt;
int result;
/* Validate the data before disabling interrupts */
@@ -484,32 +483,20 @@ int do_adjtimex(struct timex *txc)
}
if (txc->modes & ADJ_SETOFFSET) {
+ struct timespec delta;
/* Validate the delta value. */
if (txc->time.tv_sec && txc->time.tv_usec < 0)
return -EINVAL;
- if (txc->modes & ADJ_NANO) {
- struct timespec tmp;
- tmp.tv_sec = txc->time.tv_sec;
- tmp.tv_nsec = txc->time.tv_usec;
- delta = timespec_to_ktime(tmp);
- } else
- delta = timeval_to_ktime(txc->time);
-
- /* Adding the delta should be an "atomic" operation. */
- local_irq_disable();
+ delta.tv_sec = txc->time.tv_sec;
+ delta.tv_nsec = txc->time.tv_usec;
+ if (!(txc->modes & ADJ_NANO))
+ delta.tv_nsec *= 1000;
+ timekeeping_inject_offset(&delta);
}
getnstimeofday(&ts);
- if (txc->modes & ADJ_SETOFFSET) {
- kt = timespec_to_ktime(ts);
- kt = ktime_add(kt, delta);
- ts = ktime_to_timespec(kt);
- do_settimeofday(&ts);
- local_irq_enable();
- }
-
write_seqlock_irq(&xtime_lock);
if (txc->modes & ADJ_ADJTIME) {
--
1.7.3.2.146.gca209
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists