diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-07-17 13:33:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-19 11:58:32 -0400 |
commit | c7e2580578671c4d19a1a83e6fdb2482cc136283 (patch) | |
tree | 59986602e0865db3aff66a12a10958c3a1b5e4c2 /kernel | |
parent | c33f2424c3941986d402c81d380d4e805870a20f (diff) |
time: Move common updates to a function
This is a backport of cc06268c6a87db156af2daed6e96a936b955cc82
While not a bugfix itself, it allows following fixes to backport
in a more straightforward manner.
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/timekeeping.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ac5b225f6a0..0b582ebeb7c 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -166,6 +166,19 @@ static struct timespec total_sleep_time; | |||
166 | */ | 166 | */ |
167 | static struct timespec raw_time; | 167 | static struct timespec raw_time; |
168 | 168 | ||
169 | /* must hold write on xtime_lock */ | ||
170 | static void timekeeping_update(bool clearntp) | ||
171 | { | ||
172 | if (clearntp) { | ||
173 | timekeeper.ntp_error = 0; | ||
174 | ntp_clear(); | ||
175 | } | ||
176 | update_vsyscall(&xtime, &wall_to_monotonic, | ||
177 | timekeeper.clock, timekeeper.mult); | ||
178 | } | ||
179 | |||
180 | |||
181 | |||
169 | /* flag for if timekeeping is suspended */ | 182 | /* flag for if timekeeping is suspended */ |
170 | int __read_mostly timekeeping_suspended; | 183 | int __read_mostly timekeeping_suspended; |
171 | 184 | ||
@@ -366,11 +379,7 @@ int do_settimeofday(const struct timespec *tv) | |||
366 | 379 | ||
367 | xtime = *tv; | 380 | xtime = *tv; |
368 | 381 | ||
369 | timekeeper.ntp_error = 0; | 382 | timekeeping_update(true); |
370 | ntp_clear(); | ||
371 | |||
372 | update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, | ||
373 | timekeeper.mult); | ||
374 | 383 | ||
375 | write_sequnlock_irqrestore(&xtime_lock, flags); | 384 | write_sequnlock_irqrestore(&xtime_lock, flags); |
376 | 385 | ||
@@ -403,11 +412,7 @@ int timekeeping_inject_offset(struct timespec *ts) | |||
403 | xtime = timespec_add(xtime, *ts); | 412 | xtime = timespec_add(xtime, *ts); |
404 | wall_to_monotonic = timespec_sub(wall_to_monotonic, *ts); | 413 | wall_to_monotonic = timespec_sub(wall_to_monotonic, *ts); |
405 | 414 | ||
406 | timekeeper.ntp_error = 0; | 415 | timekeeping_update(true); |
407 | ntp_clear(); | ||
408 | |||
409 | update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, | ||
410 | timekeeper.mult); | ||
411 | 416 | ||
412 | write_sequnlock_irqrestore(&xtime_lock, flags); | 417 | write_sequnlock_irqrestore(&xtime_lock, flags); |
413 | 418 | ||
@@ -630,10 +635,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta) | |||
630 | 635 | ||
631 | __timekeeping_inject_sleeptime(delta); | 636 | __timekeeping_inject_sleeptime(delta); |
632 | 637 | ||
633 | timekeeper.ntp_error = 0; | 638 | timekeeping_update(true); |
634 | ntp_clear(); | ||
635 | update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, | ||
636 | timekeeper.mult); | ||
637 | 639 | ||
638 | write_sequnlock_irqrestore(&xtime_lock, flags); | 640 | write_sequnlock_irqrestore(&xtime_lock, flags); |
639 | 641 | ||
@@ -938,9 +940,7 @@ static void update_wall_time(void) | |||
938 | wall_to_monotonic.tv_sec -= leap; | 940 | wall_to_monotonic.tv_sec -= leap; |
939 | } | 941 | } |
940 | 942 | ||
941 | /* check to see if there is a new clocksource to use */ | 943 | timekeeping_update(false); |
942 | update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, | ||
943 | timekeeper.mult); | ||
944 | } | 944 | } |
945 | 945 | ||
946 | /** | 946 | /** |