Skip to content

Commit ced918e

Browse files
committed
i8253: Convert i8253_lock to raw_spinlock
i8253_lock needs to be a real spinlock in preempt-rt, i.e. it can not be converted to a sleeping lock. Convert it to raw_spinlock and fix up all users. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Takashi Iwai <tiwai@suse.de> Cc: Jens Axboe <jens.axboe@oracle.com> LKML-Reference: <20100217163751.030764372@linutronix.de>
1 parent 13dda80 commit ced918e

12 files changed

Lines changed: 36 additions & 36 deletions

File tree

‎arch/mips/include/asm/i8253.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#define PIT_CH0 0x40
1313
#define PIT_CH2 0x42
1414

15-
extern spinlock_t i8253_lock;
15+
extern raw_spinlock_t i8253_lock;
1616

1717
extern void setup_pit_timer(void);
1818

‎arch/mips/kernel/i8253.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <asm/io.h>
1616
#include <asm/time.h>
1717

18-
DEFINE_SPINLOCK(i8253_lock);
18+
DEFINE_RAW_SPINLOCK(i8253_lock);
1919
EXPORT_SYMBOL(i8253_lock);
2020

2121
/*
@@ -26,7 +26,7 @@ EXPORT_SYMBOL(i8253_lock);
2626
static void init_pit_timer(enum clock_event_mode mode,
2727
struct clock_event_device *evt)
2828
{
29-
spin_lock(&i8253_lock);
29+
raw_spin_lock(&i8253_lock);
3030

3131
switch(mode) {
3232
case CLOCK_EVT_MODE_PERIODIC:
@@ -55,7 +55,7 @@ static void init_pit_timer(enum clock_event_mode mode,
5555
/* Nothing to do here */
5656
break;
5757
}
58-
spin_unlock(&i8253_lock);
58+
raw_spin_unlock(&i8253_lock);
5959
}
6060

6161
/*
@@ -65,10 +65,10 @@ static void init_pit_timer(enum clock_event_mode mode,
6565
*/
6666
static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
6767
{
68-
spin_lock(&i8253_lock);
68+
raw_spin_lock(&i8253_lock);
6969
outb_p(delta & 0xff , PIT_CH0); /* LSB */
7070
outb(delta >> 8 , PIT_CH0); /* MSB */
71-
spin_unlock(&i8253_lock);
71+
raw_spin_unlock(&i8253_lock);
7272

7373
return 0;
7474
}
@@ -137,7 +137,7 @@ static cycle_t pit_read(struct clocksource *cs)
137137
static int old_count;
138138
static u32 old_jifs;
139139

140-
spin_lock_irqsave(&i8253_lock, flags);
140+
raw_spin_lock_irqsave(&i8253_lock, flags);
141141
/*
142142
* Although our caller may have the read side of xtime_lock,
143143
* this is now a seqlock, and we are cheating in this routine
@@ -183,7 +183,7 @@ static cycle_t pit_read(struct clocksource *cs)
183183
old_count = count;
184184
old_jifs = jifs;
185185

186-
spin_unlock_irqrestore(&i8253_lock, flags);
186+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
187187

188188
count = (LATCH - 1) - count;
189189

‎arch/x86/include/asm/i8253.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#define PIT_CH0 0x40
77
#define PIT_CH2 0x42
88

9-
extern spinlock_t i8253_lock;
9+
extern raw_spinlock_t i8253_lock;
1010

1111
extern struct clock_event_device *global_clock_event;
1212

‎arch/x86/kernel/apm_32.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,15 +1224,15 @@ static void reinit_timer(void)
12241224
#ifdef INIT_TIMER_AFTER_SUSPEND
12251225
unsigned long flags;
12261226

1227-
spin_lock_irqsave(&i8253_lock, flags);
1227+
raw_spin_lock_irqsave(&i8253_lock, flags);
12281228
/* set the clock to HZ */
12291229
outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
12301230
udelay(10);
12311231
outb_pit(LATCH & 0xff, PIT_CH0); /* LSB */
12321232
udelay(10);
12331233
outb_pit(LATCH >> 8, PIT_CH0); /* MSB */
12341234
udelay(10);
1235-
spin_unlock_irqrestore(&i8253_lock, flags);
1235+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
12361236
#endif
12371237
}
12381238

‎arch/x86/kernel/i8253.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <asm/hpet.h>
1717
#include <asm/smp.h>
1818

19-
DEFINE_SPINLOCK(i8253_lock);
19+
DEFINE_RAW_SPINLOCK(i8253_lock);
2020
EXPORT_SYMBOL(i8253_lock);
2121

2222
/*
@@ -33,7 +33,7 @@ struct clock_event_device *global_clock_event;
3333
static void init_pit_timer(enum clock_event_mode mode,
3434
struct clock_event_device *evt)
3535
{
36-
spin_lock(&i8253_lock);
36+
raw_spin_lock(&i8253_lock);
3737

3838
switch (mode) {
3939
case CLOCK_EVT_MODE_PERIODIC:
@@ -62,7 +62,7 @@ static void init_pit_timer(enum clock_event_mode mode,
6262
/* Nothing to do here */
6363
break;
6464
}
65-
spin_unlock(&i8253_lock);
65+
raw_spin_unlock(&i8253_lock);
6666
}
6767

6868
/*
@@ -72,10 +72,10 @@ static void init_pit_timer(enum clock_event_mode mode,
7272
*/
7373
static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
7474
{
75-
spin_lock(&i8253_lock);
75+
raw_spin_lock(&i8253_lock);
7676
outb_pit(delta & 0xff , PIT_CH0); /* LSB */
7777
outb_pit(delta >> 8 , PIT_CH0); /* MSB */
78-
spin_unlock(&i8253_lock);
78+
raw_spin_unlock(&i8253_lock);
7979

8080
return 0;
8181
}
@@ -130,7 +130,7 @@ static cycle_t pit_read(struct clocksource *cs)
130130
int count;
131131
u32 jifs;
132132

133-
spin_lock_irqsave(&i8253_lock, flags);
133+
raw_spin_lock_irqsave(&i8253_lock, flags);
134134
/*
135135
* Although our caller may have the read side of xtime_lock,
136136
* this is now a seqlock, and we are cheating in this routine
@@ -176,7 +176,7 @@ static cycle_t pit_read(struct clocksource *cs)
176176
old_count = count;
177177
old_jifs = jifs;
178178

179-
spin_unlock_irqrestore(&i8253_lock, flags);
179+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
180180

181181
count = (LATCH - 1) - count;
182182

‎drivers/block/hd.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ unsigned long read_timer(void)
165165
unsigned long t, flags;
166166
int i;
167167

168-
spin_lock_irqsave(&i8253_lock, flags);
168+
raw_spin_lock_irqsave(&i8253_lock, flags);
169169
t = jiffies * 11932;
170170
outb_p(0, 0x43);
171171
i = inb_p(0x40);
172172
i |= inb(0x40) << 8;
173-
spin_unlock_irqrestore(&i8253_lock, flags);
173+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
174174
return(t - i);
175175
}
176176
#endif

‎drivers/input/gameport/gameport.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ static unsigned int get_time_pit(void)
5959
unsigned long flags;
6060
unsigned int count;
6161

62-
spin_lock_irqsave(&i8253_lock, flags);
62+
raw_spin_lock_irqsave(&i8253_lock, flags);
6363
outb_p(0x00, 0x43);
6464
count = inb_p(0x40);
6565
count |= inb_p(0x40) << 8;
66-
spin_unlock_irqrestore(&i8253_lock, flags);
66+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
6767

6868
return count;
6969
}

‎drivers/input/joystick/analog.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ static unsigned int get_time_pit(void)
146146
unsigned long flags;
147147
unsigned int count;
148148

149-
spin_lock_irqsave(&i8253_lock, flags);
149+
raw_spin_lock_irqsave(&i8253_lock, flags);
150150
outb_p(0x00, 0x43);
151151
count = inb_p(0x40);
152152
count |= inb_p(0x40) << 8;
153-
spin_unlock_irqrestore(&i8253_lock, flags);
153+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
154154

155155
return count;
156156
}

‎drivers/input/misc/pcspkr.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MODULE_ALIAS("platform:pcspkr");
3030
#include <asm/i8253.h>
3131
#else
3232
#include <asm/8253pit.h>
33-
static DEFINE_SPINLOCK(i8253_lock);
33+
static DEFINE_RAW_SPINLOCK(i8253_lock);
3434
#endif
3535

3636
static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
@@ -50,7 +50,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
5050
if (value > 20 && value < 32767)
5151
count = PIT_TICK_RATE / value;
5252

53-
spin_lock_irqsave(&i8253_lock, flags);
53+
raw_spin_lock_irqsave(&i8253_lock, flags);
5454

5555
if (count) {
5656
/* set command for counter 2, 2 byte write */
@@ -65,7 +65,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
6565
outb(inb_p(0x61) & 0xFC, 0x61);
6666
}
6767

68-
spin_unlock_irqrestore(&i8253_lock, flags);
68+
raw_spin_unlock_irqrestore(&i8253_lock, flags);
6969

7070
return 0;
7171
}

‎sound/drivers/pcsp/pcsp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <asm/i8253.h>
1717
#else
1818
#include <asm/8253pit.h>
19-
static DEFINE_SPINLOCK(i8253_lock);
19+
static DEFINE_RAW_SPINLOCK(i8253_lock);
2020
#endif
2121

2222
#define PCSP_SOUND_VERSION 0x400 /* read 4.00 */

0 commit comments

Comments
 (0)