From e56fd241351c2de2c2f2589488fbaac73dcdadab Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 30 Jan 2008 13:30:03 +0100 Subject: [PATCH] --- yaml --- r: 79698 b: refs/heads/master c: 1a0c009ac53de4a7664a1239936f0bc258133156 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/i8253.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 29e055336e3a..50fe8e647547 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4713e22ce81eb8b3353e16435362eb3d0ec95640 +refs/heads/master: 1a0c009ac53de4a7664a1239936f0bc258133156 diff --git a/trunk/arch/x86/kernel/i8253.c b/trunk/arch/x86/kernel/i8253.c index decc5d294d76..377c3f8411f8 100644 --- a/trunk/arch/x86/kernel/i8253.c +++ b/trunk/arch/x86/kernel/i8253.c @@ -18,6 +18,12 @@ DEFINE_SPINLOCK(i8253_lock); EXPORT_SYMBOL(i8253_lock); +#ifdef CONFIG_X86_32 +static void pit_disable_clocksource(void); +#else +static inline void pit_disable_clocksource(void) { } +#endif + /* * HPET replaces the PIT, when enabled. So we need to know, which of * the two timers is used @@ -52,11 +58,13 @@ static void init_pit_timer(enum clock_event_mode mode, outb_p(0, PIT_CH0); outb_p(0, PIT_CH0); } + pit_disable_clocksource(); break; case CLOCK_EVT_MODE_ONESHOT: /* One shot setup */ outb_p(0x38, PIT_MODE); + pit_disable_clocksource(); break; case CLOCK_EVT_MODE_RESUME: @@ -196,6 +204,17 @@ static struct clocksource clocksource_pit = { .shift = 20, }; +static void pit_disable_clocksource(void) +{ + /* + * Use mult to check whether it is registered or not + */ + if (clocksource_pit.mult) { + clocksource_unregister(&clocksource_pit); + clocksource_pit.mult = 0; + } +} + static int __init init_pit_clocksource(void) { /*