diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-22 12:42:59 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-25 18:38:09 +0100 |
commit | 9ce616aaefcb9309cb9c49a36310ebda6061b98b (patch) | |
tree | ec9c1d67c282f4a28844b72d21ce4412b84f377c /kernel/time/ntp.c | |
parent | bbd1267690bb6940d0722dd33e929442c0409c01 (diff) | |
download | kernel_samsung_crespo-9ce616aaefcb9309cb9c49a36310ebda6061b98b.zip kernel_samsung_crespo-9ce616aaefcb9309cb9c49a36310ebda6061b98b.tar.gz kernel_samsung_crespo-9ce616aaefcb9309cb9c49a36310ebda6061b98b.tar.bz2 |
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/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 2b758c9..7d281d9 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -77,24 +77,33 @@ static long ntp_tick_adj; * NTP methods: */ +/* + * Update (tick_length, tick_length_base, tick_nsec), based + * on (tick_usec, ntp_tick_adj, time_freq): + */ static void ntp_update_frequency(void) { - u64 old_tick_length_base = tick_length_base; - u64 second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) - << NTP_SCALE_SHIFT; - second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; - second_length += time_freq; + u64 prev_base; + u64 second_length; + + prev_base = tick_length_base; + + second_length = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) + << NTP_SCALE_SHIFT; + + second_length += (s64)ntp_tick_adj << NTP_SCALE_SHIFT; + second_length += time_freq; - tick_length_base = second_length; + 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); + tick_nsec = div_u64(second_length, HZ) >> NTP_SCALE_SHIFT; + tick_length_base = div_u64(tick_length_base, NTP_INTERVAL_FREQ); /* * Don't wait for the next second_overflow, apply * the change to the tick length immediately */ - tick_length += tick_length_base - old_tick_length_base; + tick_length += tick_length_base - prev_base; } static void ntp_update_offset(long offset) |