aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/timex.h4
-rw-r--r--kernel/time/ntp.c16
-rw-r--r--kernel/time/timekeeping.c5
3 files changed, 6 insertions, 19 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 5994d39de778..da431f8c5c6e 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -239,8 +239,8 @@ static inline int ntp_synced(void)
239#endif 239#endif
240#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ) 240#define NTP_INTERVAL_LENGTH (NSEC_PER_SEC/NTP_INTERVAL_FREQ)
241 241
242/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 242/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
243extern u64 current_tick_length(void); 243extern u64 tick_length;
244 244
245extern void second_overflow(void); 245extern void second_overflow(void);
246extern void update_ntp_one_tick(void); 246extern void update_ntp_one_tick(void);
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index a8fd1ba1ef19..df9718bac8d0 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -23,7 +23,8 @@
23 */ 23 */
24unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */ 24unsigned long tick_usec = TICK_USEC; /* USER_HZ period (usec) */
25unsigned long tick_nsec; /* ACTHZ period (nsec) */ 25unsigned long tick_nsec; /* ACTHZ period (nsec) */
26static u64 tick_length, tick_length_base; 26u64 tick_length;
27static u64 tick_length_base;
27 28
28#define MAX_TICKADJ 500 /* microsecs */ 29#define MAX_TICKADJ 500 /* microsecs */
29#define MAX_TICKADJ_SCALED (((u64)(MAX_TICKADJ * NSEC_PER_USEC) << \ 30#define MAX_TICKADJ_SCALED (((u64)(MAX_TICKADJ * NSEC_PER_USEC) << \
@@ -203,19 +204,6 @@ void second_overflow(void)
203 } 204 }
204} 205}
205 206
206/*
207 * Return how long ticks are at the moment, that is, how much time
208 * update_wall_time_one_tick will add to xtime next time we call it
209 * (assuming no calls to do_adjtimex in the meantime).
210 * The return value is in fixed-point nanoseconds shifted by the
211 * specified number of bits to the right of the binary point.
212 * This function has no side-effects.
213 */
214u64 current_tick_length(void)
215{
216 return tick_length;
217}
218
219#ifdef CONFIG_GENERIC_CMOS_UPDATE 207#ifdef CONFIG_GENERIC_CMOS_UPDATE
220 208
221/* Disable the cmos update - used by virtualization and embedded */ 209/* Disable the cmos update - used by virtualization and embedded */
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index a26429bc772a..7e74d8092067 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -380,8 +380,7 @@ static __always_inline int clocksource_bigadjust(s64 error, s64 *interval,
380 * Now calculate the error in (1 << look_ahead) ticks, but first 380 * Now calculate the error in (1 << look_ahead) ticks, but first
381 * remove the single look ahead already included in the error. 381 * remove the single look ahead already included in the error.
382 */ 382 */
383 tick_error = current_tick_length() >> 383 tick_error = tick_length >> (NTP_SCALE_SHIFT - clock->shift + 1);
384 (NTP_SCALE_SHIFT - clock->shift + 1);
385 tick_error -= clock->xtime_interval >> 1; 384 tick_error -= clock->xtime_interval >> 1;
386 error = ((error - tick_error) >> look_ahead) + tick_error; 385 error = ((error - tick_error) >> look_ahead) + tick_error;
387 386
@@ -473,7 +472,7 @@ void update_wall_time(void)
473 } 472 }
474 473
475 /* accumulate error between NTP and clock interval */ 474 /* accumulate error between NTP and clock interval */
476 clock->error += current_tick_length(); 475 clock->error += tick_length;
477 clock->error -= clock->xtime_interval << (NTP_SCALE_SHIFT - clock->shift); 476 clock->error -= clock->xtime_interval << (NTP_SCALE_SHIFT - clock->shift);
478 } 477 }
479 478