aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-22 06:42:59 -0500
committerIngo Molnar <mingo@elte.hu>2009-02-25 12:38:09 -0500
commit9ce616aaefcb9309cb9c49a36310ebda6061b98b (patch)
treeec9c1d67c282f4a28844b72d21ce4412b84f377c /kernel/time
parentbbd1267690bb6940d0722dd33e929442c0409c01 (diff)
time: ntp: clean up ntp_update_frequency()
Impact: cleanup, no functionality changed Prepare a refactoring of ntp_update_frequency(). kernel/time/ntp.o: text data bss dec hex filename 2504 114 136 2754 ac2 ntp.o.before 2504 114 136 2754 ac2 ntp.o.after md5: 41f3009debc9b397d7394dd77d912f0a ntp.o.before.asm 41f3009debc9b397d7394dd77d912f0a ntp.o.after.asm Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/ntp.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 2b758c935c65..7d281d9fbe30 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -77,24 +77,33 @@ static long ntp_tick_adj;
77 * NTP methods: 77 * NTP methods:
78 */ 78 */
79 79
80/*
81 * Update (tick_length, tick_length_base, tick_nsec), based
82 * on (tick_usec, ntp_tick_adj, time_freq):
83 */
80static void ntp_update_frequency(void) 84static void ntp_update_frequency(void)
81{ 85{
82 u64 old_tick_length_base = tick_length_base; 86 u64 prev_base;
83 u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) 87 u64 second_length;
84 << NTP_SCALE_SHIFT; 88
85 second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; 89 prev_base = tick_length_base;
86 second_length += time_freq; 90
91 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
92 << NTP_SCALE_SHIFT;
93
94 second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT;
95 second_length += time_freq;
87 96
88 tick_length_base = second_length; 97 tick_length_base = second_length;
89 98
90 tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; 99 tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT;
91 tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ); 100 tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ);
92 101
93 /* 102 /*
94 * Don't wait for the next second_overflow, apply 103 * Don't wait for the next second_overflow, apply
95 * the change to the tick length immediately 104 * the change to the tick length immediately
96 */ 105 */
97 tick_length += tick_length_base - old_tick_length_base; 106 tick_length += tick_length_base - prev_base;
98} 107}
99 108
100static void ntp_update_offset(long offset) 109static void ntp_update_offset(long offset)