diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2008-01-30 07:30:47 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:47 -0500 |
commit | 5f627f8e122a163ce53908d55e088247db31f1d7 (patch) | |
tree | 15e48b30394cbfd014aaf7f99f5a4bfee5b8efbb /arch | |
parent | b263295dbffd33b0fbff670720fa178c30e3392a (diff) |
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: Ralf Baechle <ralf@linux-mips.org>
Acked-by:Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/i8253.c | 12 | ||||
-rw-r--r-- | arch/x86/kernel/i8253.c | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c index c2d497ceffdd..fc4aa07b6d35 100644 --- a/arch/mips/kernel/i8253.c +++ b/arch/mips/kernel/i8253.c | |||
@@ -24,9 +24,7 @@ DEFINE_SPINLOCK(i8253_lock); | |||
24 | static void init_pit_timer(enum clock_event_mode mode, | 24 | static void init_pit_timer(enum clock_event_mode mode, |
25 | struct clock_event_device *evt) | 25 | struct clock_event_device *evt) |
26 | { | 26 | { |
27 | unsigned long flags; | 27 | spin_lock(&i8253_lock); |
28 | |||
29 | spin_lock_irqsave(&i8253_lock, flags); | ||
30 | 28 | ||
31 | switch(mode) { | 29 | switch(mode) { |
32 | case CLOCK_EVT_MODE_PERIODIC: | 30 | case CLOCK_EVT_MODE_PERIODIC: |
@@ -55,7 +53,7 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
55 | /* Nothing to do here */ | 53 | /* Nothing to do here */ |
56 | break; | 54 | break; |
57 | } | 55 | } |
58 | spin_unlock_irqrestore(&i8253_lock, flags); | 56 | spin_unlock(&i8253_lock); |
59 | } | 57 | } |
60 | 58 | ||
61 | /* | 59 | /* |
@@ -65,12 +63,10 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
65 | */ | 63 | */ |
66 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) | 64 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) |
67 | { | 65 | { |
68 | unsigned long flags; | 66 | spin_lock(&i8253_lock); |
69 | |||
70 | spin_lock_irqsave(&i8253_lock, flags); | ||
71 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ | 67 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ |
72 | outb(delta >> 8 , PIT_CH0); /* MSB */ | 68 | outb(delta >> 8 , PIT_CH0); /* MSB */ |
73 | spin_unlock_irqrestore(&i8253_lock, flags); | 69 | spin_unlock(&i8253_lock); |
74 | 70 | ||
75 | return 0; | 71 | return 0; |
76 | } | 72 | } |
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c index 377c3f8411f8..c76fef1ce355 100644 --- a/arch/x86/kernel/i8253.c +++ b/arch/x86/kernel/i8253.c | |||
@@ -38,9 +38,7 @@ struct clock_event_device *global_clock_event; | |||
38 | static void init_pit_timer(enum clock_event_mode mode, | 38 | static void init_pit_timer(enum clock_event_mode mode, |
39 | struct clock_event_device *evt) | 39 | struct clock_event_device *evt) |
40 | { | 40 | { |
41 | unsigned long flags; | 41 | spin_lock(&i8253_lock); |
42 | |||
43 | spin_lock_irqsave(&i8253_lock, flags); | ||
44 | 42 | ||
45 | switch(mode) { | 43 | switch(mode) { |
46 | case CLOCK_EVT_MODE_PERIODIC: | 44 | case CLOCK_EVT_MODE_PERIODIC: |
@@ -71,7 +69,7 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
71 | /* Nothing to do here */ | 69 | /* Nothing to do here */ |
72 | break; | 70 | break; |
73 | } | 71 | } |
74 | spin_unlock_irqrestore(&i8253_lock, flags); | 72 | spin_unlock(&i8253_lock); |
75 | } | 73 | } |
76 | 74 | ||
77 | /* | 75 | /* |
@@ -81,12 +79,10 @@ static void init_pit_timer(enum clock_event_mode mode, | |||
81 | */ | 79 | */ |
82 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) | 80 | static int pit_next_event(unsigned long delta, struct clock_event_device *evt) |
83 | { | 81 | { |
84 | unsigned long flags; | 82 | spin_lock(&i8253_lock); |
85 | |||
86 | spin_lock_irqsave(&i8253_lock, flags); | ||
87 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ | 83 | outb_p(delta & 0xff , PIT_CH0); /* LSB */ |
88 | outb(delta >> 8 , PIT_CH0); /* MSB */ | 84 | outb(delta >> 8 , PIT_CH0); /* MSB */ |
89 | spin_unlock_irqrestore(&i8253_lock, flags); | 85 | spin_unlock(&i8253_lock); |
90 | 86 | ||
91 | return 0; | 87 | return 0; |
92 | } | 88 | } |