diff options
author | Adrian Bunk <bunk@stusta.de> | 2006-10-01 02:28:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:27 -0400 |
commit | 70bc42f90a3f4721c89dbe865e6c95da8565b41c (patch) | |
tree | b98b1b19584c4dfcec283715a14a701139ea32d1 /kernel/time/ntp.c | |
parent | 0883d899ef862c1b0f8b2c2d38098470c193a3dd (diff) |
[PATCH] kernel/time/ntp.c: possible cleanups
This patch contains the following possible cleanups:
- make the following needlessly global function static:
- ntp_update_frequency()
- make the following needlessly global variables static:
- time_state
- time_offset
- time_constant
- time_reftime
- remove the following read-only global variable:
- time_precision
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: john stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 1ab5e9d7fa50..47195fa0ec4f 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -30,17 +30,31 @@ static u64 tick_length, tick_length_base; | |||
30 | * phase-lock loop variables | 30 | * phase-lock loop variables |
31 | */ | 31 | */ |
32 | /* TIME_ERROR prevents overwriting the CMOS clock */ | 32 | /* TIME_ERROR prevents overwriting the CMOS clock */ |
33 | int time_state = TIME_OK; /* clock synchronization status */ | 33 | static int time_state = TIME_OK; /* clock synchronization status */ |
34 | int time_status = STA_UNSYNC; /* clock status bits */ | 34 | int time_status = STA_UNSYNC; /* clock status bits */ |
35 | long time_offset; /* time adjustment (ns) */ | 35 | static long time_offset; /* time adjustment (ns) */ |
36 | long time_constant = 2; /* pll time constant */ | 36 | static long time_constant = 2; /* pll time constant */ |
37 | long time_precision = 1; /* clock precision (us) */ | ||
38 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ | 37 | long time_maxerror = NTP_PHASE_LIMIT; /* maximum error (us) */ |
39 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ | 38 | long time_esterror = NTP_PHASE_LIMIT; /* estimated error (us) */ |
40 | long time_freq; /* frequency offset (scaled ppm)*/ | 39 | long time_freq; /* frequency offset (scaled ppm)*/ |
41 | long time_reftime; /* time at last adjustment (s) */ | 40 | static long time_reftime; /* time at last adjustment (s) */ |
42 | long time_adjust; | 41 | long time_adjust; |
43 | 42 | ||
43 | #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) | ||
44 | #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / \ | ||
45 | (s64)CLOCK_TICK_RATE) | ||
46 | |||
47 | static void ntp_update_frequency(void) | ||
48 | { | ||
49 | tick_length_base = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) << TICK_LENGTH_SHIFT; | ||
50 | tick_length_base += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT; | ||
51 | tick_length_base += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC); | ||
52 | |||
53 | do_div(tick_length_base, HZ); | ||
54 | |||
55 | tick_nsec = tick_length_base >> TICK_LENGTH_SHIFT; | ||
56 | } | ||
57 | |||
44 | /** | 58 | /** |
45 | * ntp_clear - Clears the NTP state variables | 59 | * ntp_clear - Clears the NTP state variables |
46 | * | 60 | * |
@@ -59,20 +73,6 @@ void ntp_clear(void) | |||
59 | time_offset = 0; | 73 | time_offset = 0; |
60 | } | 74 | } |
61 | 75 | ||
62 | #define CLOCK_TICK_OVERFLOW (LATCH * HZ - CLOCK_TICK_RATE) | ||
63 | #define CLOCK_TICK_ADJUST (((s64)CLOCK_TICK_OVERFLOW * NSEC_PER_SEC) / (s64)CLOCK_TICK_RATE) | ||
64 | |||
65 | void ntp_update_frequency(void) | ||
66 | { | ||
67 | tick_length_base = (u64)(tick_usec * NSEC_PER_USEC * USER_HZ) << TICK_LENGTH_SHIFT; | ||
68 | tick_length_base += (s64)CLOCK_TICK_ADJUST << TICK_LENGTH_SHIFT; | ||
69 | tick_length_base += (s64)time_freq << (TICK_LENGTH_SHIFT - SHIFT_NSEC); | ||
70 | |||
71 | do_div(tick_length_base, HZ); | ||
72 | |||
73 | tick_nsec = tick_length_base >> TICK_LENGTH_SHIFT; | ||
74 | } | ||
75 | |||
76 | /* | 76 | /* |
77 | * this routine handles the overflow of the microsecond field | 77 | * this routine handles the overflow of the microsecond field |
78 | * | 78 | * |
@@ -330,7 +330,7 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) | |||
330 | txc->esterror = time_esterror; | 330 | txc->esterror = time_esterror; |
331 | txc->status = time_status; | 331 | txc->status = time_status; |
332 | txc->constant = time_constant; | 332 | txc->constant = time_constant; |
333 | txc->precision = time_precision; | 333 | txc->precision = 1; |
334 | txc->tolerance = MAXFREQ; | 334 | txc->tolerance = MAXFREQ; |
335 | txc->tick = tick_usec; | 335 | txc->tick = tick_usec; |
336 | 336 | ||