diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-02-22 06:06:57 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-25 12:38:07 -0500 |
commit | 3c972c2444dcb7088999c32b8c5a7ab3b8a6c0b6 (patch) | |
tree | 0d89d2cfff1b3b32192ed54c70ee183356a11191 /kernel/time/ntp.c | |
parent | 53bbfa9e9437e70b322368e82c723112d690e304 (diff) |
time: ntp: simplify the second_overflow() code flow
Impact: cleanup, no functionality changed
Instead of a hierarchy of conditions, transform them to clean
gradual conditions and return's.
This makes the flow easier to read and makes the purpose of
the function easier to understand.
kernel/time/ntp.o:
text data bss dec hex filename
2552 170 168 2890 b4a ntp.o.before
2552 170 168 2890 b4a ntp.o.after
md5:
eae1275df0b7d6290c13f6f6f8f05c8c ntp.o.before.asm
eae1275df0b7d6290c13f6f6f8f05c8c 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 | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 3479ec48e604..1fa6615b317a 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -232,19 +232,24 @@ void second_overflow(void) | |||
232 | time_offset -= time_adj; | 232 | time_offset -= time_adj; |
233 | tick_length += time_adj; | 233 | tick_length += time_adj; |
234 | 234 | ||
235 | if (unlikely(time_adjust)) { | 235 | if (!time_adjust) |
236 | if (time_adjust > MAX_TICKADJ) { | 236 | return; |
237 | time_adjust -= MAX_TICKADJ; | 237 | |
238 | tick_length += MAX_TICKADJ_SCALED; | 238 | if (time_adjust > MAX_TICKADJ) { |
239 | } else if (time_adjust < -MAX_TICKADJ) { | 239 | time_adjust -= MAX_TICKADJ; |
240 | time_adjust += MAX_TICKADJ; | 240 | tick_length += MAX_TICKADJ_SCALED; |
241 | tick_length -= MAX_TICKADJ_SCALED; | 241 | return; |
242 | } else { | ||
243 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / | ||
244 | NTP_INTERVAL_FREQ) << NTP_SCALE_SHIFT; | ||
245 | time_adjust = 0; | ||
246 | } | ||
247 | } | 242 | } |
243 | |||
244 | if (time_adjust < -MAX_TICKADJ) { | ||
245 | time_adjust += MAX_TICKADJ; | ||
246 | tick_length -= MAX_TICKADJ_SCALED; | ||
247 | return; | ||
248 | } | ||
249 | |||
250 | tick_length += (s64)(time_adjust * NSEC_PER_USEC / NTP_INTERVAL_FREQ) | ||
251 | << NTP_SCALE_SHIFT; | ||
252 | time_adjust = 0; | ||
248 | } | 253 | } |
249 | 254 | ||
250 | #ifdef CONFIG_GENERIC_CMOS_UPDATE | 255 | #ifdef CONFIG_GENERIC_CMOS_UPDATE |