summaryrefslogtreecommitdiffstats
path: root/kernel/time
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-02-22 12:17:36 +0100
committerIngo Molnar <mingo@elte.hu>2009-02-25 18:38:10 +0100
commitbc26c31d446bc9c24cd6f7003777a05fe268ae48 (patch)
tree26b1738745cd7f81af2259239799a0798cbe212b /kernel/time
parent9ce616aaefcb9309cb9c49a36310ebda6061b98b (diff)
time: ntp: refactor up ntp_update_frequency()
Impact: cleanup, no functionality changed Change ntp_update_frequency() from a hard to follow code flow that uses global variables as temporaries, to a clean input+output flow. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/ntp.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 7d281d9fbe3..f1abad73857 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -83,10 +83,8 @@ static long ntp_tick_adj;
*/
static void ntp_update_frequency(void)
{
- u64 prev_base;
u64 second_length;
-
- prev_base = tick_length_base;
+ u64 new_base;
second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ)
<< NTP_SCALE_SHIFT;
@@ -94,16 +92,15 @@ static void ntp_update_frequency(void)
second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT;
second_length += time_freq;
- tick_length_base = second_length;
-
tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT;
- tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ);
+ new_base = div_u64(second_length, NTP_INTERVAL_FREQ);
/*
* Don't wait for the next second_overflow, apply
- * the change to the tick length immediately
+ * the change to the tick length immediately:
*/
- tick_length += tick_length_base - prev_base;
+ tick_length += new_base - tick_length_base;
+ tick_length_base = new_base;
}
static void ntp_update_offset(long offset)