From 42cb68d81a218b0fd7c053356d379a93270b40ea Mon Sep 17 00:00:00 2001 From: Yong Wang Date: Fri, 30 Oct 2009 10:33:20 +0800 Subject: [PATCH] x86: Do not unregister PIT clocksource on PIT oneshot setup/shutdown Backported from upstream commit 8cab02dc3c58a12235c6d463ce684dded9696848 and this fixes bug #7377 "system can not resume from S3". Further information can be found at http://bugzilla.kernel.org/show_bug.cgi?id=14222. Signed-off-by: Yong Wang --- arch/x86/kernel/i8253.c | 36 ++---------------------------------- 1 files changed, 2 insertions(+), 34 deletions(-) diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c index da890f0..23c1679 100644 --- a/arch/x86/kernel/i8253.c +++ b/arch/x86/kernel/i8253.c @@ -19,14 +19,6 @@ DEFINE_SPINLOCK(i8253_lock); EXPORT_SYMBOL(i8253_lock); -#ifdef CONFIG_X86_32 -static void pit_disable_clocksource(void); -static void pit_enable_clocksource(void); -#else -static inline void pit_disable_clocksource(void) { } -static inline void pit_enable_clocksource(void) { } -#endif - /* * HPET replaces the PIT, when enabled. So we need to know, which of * the two timers is used @@ -59,17 +51,15 @@ static void init_pit_timer(enum clock_event_mode mode, outb_pit(0, PIT_CH0); outb_pit(0, PIT_CH0); } - pit_disable_clocksource(); break; case CLOCK_EVT_MODE_ONESHOT: /* One shot setup */ - pit_disable_clocksource(); outb_pit(0x38, PIT_MODE); break; case CLOCK_EVT_MODE_RESUME: - pit_enable_clocksource(); + /* Nothing to do here */ break; } spin_unlock(&i8253_lock); @@ -202,27 +192,8 @@ static struct clocksource pit_cs = { .shift = 20, }; -int pit_cs_registered; -static void pit_disable_clocksource(void) -{ - if (pit_cs_registered) { - clocksource_unregister(&pit_cs); - pit_cs_registered = 0; - } -} - -static void pit_enable_clocksource(void) -{ - if (!pit_cs_registered && !clocksource_register(&pit_cs)) { - pit_cs_registered = 1; - } -} - - - static int __init init_pit_clocksource(void) { - int ret; /* * Several reasons not to register PIT as a clocksource: * @@ -236,10 +207,7 @@ static int __init init_pit_clocksource(void) pit_cs.mult = clocksource_hz2mult(CLOCK_TICK_RATE, pit_cs.shift); - ret = clocksource_register(&pit_cs); - if (!ret) - pit_cs_registered = 1; - return ret; + return clocksource_register(&pit_cs); } arch_initcall(init_pit_clocksource); -- 1.5.5.1