aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--include/linux/timex.h2
-rw-r--r--kernel/timer.c21
3 files changed, 19 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index d20907561f46..742f07a63161 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -534,7 +534,7 @@ static __inline__ void timer_recalc_offset(u64 cur_tb)
534 534
535 if (__USE_RTC()) 535 if (__USE_RTC())
536 return; 536 return;
537 tlen = current_tick_length(); 537 tlen = current_tick_length(SHIFT_SCALE - 10);
538 offset = cur_tb - do_gtod.varp->tb_orig_stamp; 538 offset = cur_tb - do_gtod.varp->tb_orig_stamp;
539 if (tlen == last_tick_len && offset < 0x80000000u) 539 if (tlen == last_tick_len && offset < 0x80000000u)
540 return; 540 return;
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 34d3ccff7bbb..1ba3071fcb82 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -304,7 +304,7 @@ time_interpolator_reset(void)
304#endif /* !CONFIG_TIME_INTERPOLATION */ 304#endif /* !CONFIG_TIME_INTERPOLATION */
305 305
306/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */ 306/* Returns how long ticks are at present, in ns / 2^(SHIFT_SCALE-10). */
307extern u64 current_tick_length(void); 307extern u64 current_tick_length(long);
308 308
309extern int do_adjtimex(struct timex *); 309extern int do_adjtimex(struct timex *);
310 310
diff --git a/kernel/timer.c b/kernel/timer.c
index 524c7f638365..623f9ea198d8 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -780,16 +780,29 @@ static void update_wall_time_one_tick(void)
780 * Return how long ticks are at the moment, that is, how much time 780 * Return how long ticks are at the moment, that is, how much time
781 * update_wall_time_one_tick will add to xtime next time we call it 781 * update_wall_time_one_tick will add to xtime next time we call it
782 * (assuming no calls to do_adjtimex in the meantime). 782 * (assuming no calls to do_adjtimex in the meantime).
783 * The return value is in fixed-point nanoseconds with SHIFT_SCALE-10 783 * The return value is in fixed-point nanoseconds shifted by the
784 * bits to the right of the binary point. 784 * specified number of bits to the right of the binary point.
785 * This function has no side-effects. 785 * This function has no side-effects.
786 */ 786 */
787u64 current_tick_length(void) 787u64 current_tick_length(long shift)
788{ 788{
789 long delta_nsec; 789 long delta_nsec;
790 u64 ret;
790 791
792 /* calculate the finest interval NTP will allow.
793 * ie: nanosecond value shifted by (SHIFT_SCALE - 10)
794 */
791 delta_nsec = tick_nsec + adjtime_adjustment() * 1000; 795 delta_nsec = tick_nsec + adjtime_adjustment() * 1000;
792 return ((u64) delta_nsec << (SHIFT_SCALE - 10)) + time_adj; 796 ret = ((u64) delta_nsec << (SHIFT_SCALE - 10)) + time_adj;
797
798 /* convert from (SHIFT_SCALE - 10) to specified shift scale: */
799 shift = shift - (SHIFT_SCALE - 10);
800 if (shift < 0)
801 ret >>= -shift;
802 else
803 ret <<= shift;
804
805 return ret;
793} 806}
794 807
795/* XXX - all of this timekeeping code should be later moved to time.c */ 808/* XXX - all of this timekeeping code should be later moved to time.c */