Commit e792570d authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] i8253 locking.

There are still a few places where we play with the RTC
directly, with no locking. This catches some of them.
parent 2323c8a9
...@@ -1166,9 +1166,13 @@ static void get_time_diff(void) ...@@ -1166,9 +1166,13 @@ static void get_time_diff(void)
#endif #endif
} }
static inline void reinit_timer(void) static void reinit_timer(void)
{ {
#ifdef INIT_TIMER_AFTER_SUSPEND #ifdef INIT_TIMER_AFTER_SUSPEND
unsigned long flags;
extern spinlock_t i8253_lock;
spin_lock_irqsave(&i8253_lock, flags);
/* set the clock to 100 Hz */ /* set the clock to 100 Hz */
outb_p(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ outb_p(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
udelay(10); udelay(10);
...@@ -1176,6 +1180,7 @@ static inline void reinit_timer(void) ...@@ -1176,6 +1180,7 @@ static inline void reinit_timer(void)
udelay(10); udelay(10);
outb(LATCH >> 8, PIT_CH0); /* MSB */ outb(LATCH >> 8, PIT_CH0); /* MSB */
udelay(10); udelay(10);
spin_unlock_irqrestore(&i8253_lock, flags);
#endif #endif
} }
......
...@@ -373,11 +373,16 @@ void __init init_ISA_irqs (void) ...@@ -373,11 +373,16 @@ void __init init_ISA_irqs (void)
static void setup_timer(void) static void setup_timer(void)
{ {
extern spinlock_t i8253_lock;
unsigned long flags;
spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
udelay(10); udelay(10);
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */ outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
udelay(10); udelay(10);
outb(LATCH >> 8 , PIT_CH0); /* MSB */ outb(LATCH >> 8 , PIT_CH0); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags);
} }
static int timer_resume(struct device *dev, u32 level) static int timer_resume(struct device *dev, u32 level)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment