Commit 5f627f8e authored by Ralf Baechle's avatar Ralf Baechle Committed by Ingo Molnar

mips, x86: optimize the i8259 code a bit

The timer code always calls the clock_event_device set_net_event and
set_mode methods with interrupts disabled, so no need to use
spin_lock_irqsave / spin_unlock_irqrestore for those.
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent b263295d
...@@ -24,9 +24,7 @@ DEFINE_SPINLOCK(i8253_lock); ...@@ -24,9 +24,7 @@ DEFINE_SPINLOCK(i8253_lock);
static void init_pit_timer(enum clock_event_mode mode, static void init_pit_timer(enum clock_event_mode mode,
struct clock_event_device *evt) struct clock_event_device *evt)
{ {
unsigned long flags; spin_lock(&i8253_lock);
spin_lock_irqsave(&i8253_lock, flags);
switch(mode) { switch(mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
...@@ -55,7 +53,7 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -55,7 +53,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */ /* Nothing to do here */
break; break;
} }
spin_unlock_irqrestore(&i8253_lock, flags); spin_unlock(&i8253_lock);
} }
/* /*
...@@ -65,12 +63,10 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -65,12 +63,10 @@ static void init_pit_timer(enum clock_event_mode mode,
*/ */
static int pit_next_event(unsigned long delta, struct clock_event_device *evt) static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
{ {
unsigned long flags; spin_lock(&i8253_lock);
spin_lock_irqsave(&i8253_lock, flags);
outb_p(delta & 0xff , PIT_CH0); /* LSB */ outb_p(delta & 0xff , PIT_CH0); /* LSB */
outb(delta >> 8 , PIT_CH0); /* MSB */ outb(delta >> 8 , PIT_CH0); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags); spin_unlock(&i8253_lock);
return 0; return 0;
} }
......
...@@ -38,9 +38,7 @@ struct clock_event_device *global_clock_event; ...@@ -38,9 +38,7 @@ struct clock_event_device *global_clock_event;
static void init_pit_timer(enum clock_event_mode mode, static void init_pit_timer(enum clock_event_mode mode,
struct clock_event_device *evt) struct clock_event_device *evt)
{ {
unsigned long flags; spin_lock(&i8253_lock);
spin_lock_irqsave(&i8253_lock, flags);
switch(mode) { switch(mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
...@@ -71,7 +69,7 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -71,7 +69,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */ /* Nothing to do here */
break; break;
} }
spin_unlock_irqrestore(&i8253_lock, flags); spin_unlock(&i8253_lock);
} }
/* /*
...@@ -81,12 +79,10 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -81,12 +79,10 @@ static void init_pit_timer(enum clock_event_mode mode,
*/ */
static int pit_next_event(unsigned long delta, struct clock_event_device *evt) static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
{ {
unsigned long flags; spin_lock(&i8253_lock);
spin_lock_irqsave(&i8253_lock, flags);
outb_p(delta & 0xff , PIT_CH0); /* LSB */ outb_p(delta & 0xff , PIT_CH0); /* LSB */
outb(delta >> 8 , PIT_CH0); /* MSB */ outb(delta >> 8 , PIT_CH0); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags); spin_unlock(&i8253_lock);
return 0; return 0;
} }
......
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