diff options
-rw-r--r-- | arch/x86/kernel/i8253.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c index decc5d294d76..377c3f8411f8 100644 --- a/arch/x86/kernel/i8253.c +++ b/arch/x86/kernel/i8253.c | |||
@@ -18,6 +18,12 @@ | |||
18 | DEFINE_SPINLOCK(i8253_lock); | 18 | DEFINE_SPINLOCK(i8253_lock); |
19 | EXPORT_SYMBOL(i8253_lock); | 19 | EXPORT_SYMBOL(i8253_lock); |
20 | 20 | ||
21 | #ifdef CONFIG_X86_32 | ||
22 | static void pit_disable_clocksource(void); | ||
23 | #else | ||
24 | static inline void pit_disable_clocksource(void) { } | ||
25 | #endif | ||
26 | |||
21 | /* | 27 | /* |
22 | * HPET replaces the PIT, when enabled. So we need to know, which of | 28 | * HPET replaces the PIT, when enabled. So we need to know, which of |
23 | * the two timers is used | 29 | * the two timers is used |
@@ -52,11 +58,13 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
52 | outb_p(0, PIT_CH0); | 58 | outb_p(0, PIT_CH0); |
53 | outb_p(0, PIT_CH0); | 59 | outb_p(0, PIT_CH0); |
54 | } | 60 | } |
61 | pit_disable_clocksource(); | ||
55 | break; | 62 | break; |
56 | 63 | ||
57 | case CLOCK_EVT_MODE_ONESHOT: | 64 | case CLOCK_EVT_MODE_ONESHOT: |
58 | /* One shot setup */ | 65 | /* One shot setup */ |
59 | outb_p(0x38, PIT_MODE); | 66 | outb_p(0x38, PIT_MODE); |
67 | pit_disable_clocksource(); | ||
60 | break; | 68 | break; |
61 | 69 | ||
62 | case CLOCK_EVT_MODE_RESUME: | 70 | case CLOCK_EVT_MODE_RESUME: |
@@ -196,6 +204,17 @@ static struct clocksource clocksource_pit = { | |||
196 | .shift = 20, | 204 | .shift = 20, |
197 | }; | 205 | }; |
198 | 206 | ||
207 | static void pit_disable_clocksource(void) | ||
208 | { | ||
209 | /* | ||
210 | * Use mult to check whether it is registered or not | ||
211 | */ | ||
212 | if (clocksource_pit.mult) { | ||
213 | clocksource_unregister(&clocksource_pit); | ||
214 | clocksource_pit.mult = 0; | ||
215 | } | ||
216 | } | ||
217 | |||
199 | static int __init init_pit_clocksource(void) | 218 | static int __init init_pit_clocksource(void) |
200 | { | 219 | { |
201 | /* | 220 | /* |