Commit ced918eb authored by Thomas Gleixner's avatar Thomas Gleixner

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: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarRalf Baechle <ralf@linux-mips.org>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
Cc: Jens Axboe <jens.axboe@oracle.com>
LKML-Reference: <20100217163751.030764372@linutronix.de>
parent 13dda80e
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#define PIT_CH0 0x40 #define PIT_CH0 0x40
#define PIT_CH2 0x42 #define PIT_CH2 0x42
extern spinlock_t i8253_lock; extern raw_spinlock_t i8253_lock;
extern void setup_pit_timer(void); extern void setup_pit_timer(void);
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/time.h> #include <asm/time.h>
DEFINE_SPINLOCK(i8253_lock); DEFINE_RAW_SPINLOCK(i8253_lock);
EXPORT_SYMBOL(i8253_lock); EXPORT_SYMBOL(i8253_lock);
/* /*
...@@ -26,7 +26,7 @@ EXPORT_SYMBOL(i8253_lock); ...@@ -26,7 +26,7 @@ EXPORT_SYMBOL(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)
{ {
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
switch(mode) { switch(mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
...@@ -55,7 +55,7 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -55,7 +55,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */ /* Nothing to do here */
break; break;
} }
spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
} }
/* /*
...@@ -65,10 +65,10 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -65,10 +65,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)
{ {
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
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(&i8253_lock); raw_spin_unlock(&i8253_lock);
return 0; return 0;
} }
...@@ -137,7 +137,7 @@ static cycle_t pit_read(struct clocksource *cs) ...@@ -137,7 +137,7 @@ static cycle_t pit_read(struct clocksource *cs)
static int old_count; static int old_count;
static u32 old_jifs; static u32 old_jifs;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
/* /*
* Although our caller may have the read side of xtime_lock, * Although our caller may have the read side of xtime_lock,
* this is now a seqlock, and we are cheating in this routine * this is now a seqlock, and we are cheating in this routine
...@@ -183,7 +183,7 @@ static cycle_t pit_read(struct clocksource *cs) ...@@ -183,7 +183,7 @@ static cycle_t pit_read(struct clocksource *cs)
old_count = count; old_count = count;
old_jifs = jifs; old_jifs = jifs;
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
count = (LATCH - 1) - count; count = (LATCH - 1) - count;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define PIT_CH0 0x40 #define PIT_CH0 0x40
#define PIT_CH2 0x42 #define PIT_CH2 0x42
extern spinlock_t i8253_lock; extern raw_spinlock_t i8253_lock;
extern struct clock_event_device *global_clock_event; extern struct clock_event_device *global_clock_event;
......
...@@ -1224,7 +1224,7 @@ static void reinit_timer(void) ...@@ -1224,7 +1224,7 @@ static void reinit_timer(void)
#ifdef INIT_TIMER_AFTER_SUSPEND #ifdef INIT_TIMER_AFTER_SUSPEND
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
/* set the clock to HZ */ /* set the clock to HZ */
outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */ outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
udelay(10); udelay(10);
...@@ -1232,7 +1232,7 @@ static void reinit_timer(void) ...@@ -1232,7 +1232,7 @@ static void reinit_timer(void)
udelay(10); udelay(10);
outb_pit(LATCH >> 8, PIT_CH0); /* MSB */ outb_pit(LATCH >> 8, PIT_CH0); /* MSB */
udelay(10); udelay(10);
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
#endif #endif
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <asm/hpet.h> #include <asm/hpet.h>
#include <asm/smp.h> #include <asm/smp.h>
DEFINE_SPINLOCK(i8253_lock); DEFINE_RAW_SPINLOCK(i8253_lock);
EXPORT_SYMBOL(i8253_lock); EXPORT_SYMBOL(i8253_lock);
/* /*
...@@ -33,7 +33,7 @@ struct clock_event_device *global_clock_event; ...@@ -33,7 +33,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)
{ {
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
switch (mode) { switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: case CLOCK_EVT_MODE_PERIODIC:
...@@ -62,7 +62,7 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -62,7 +62,7 @@ static void init_pit_timer(enum clock_event_mode mode,
/* Nothing to do here */ /* Nothing to do here */
break; break;
} }
spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
} }
/* /*
...@@ -72,10 +72,10 @@ static void init_pit_timer(enum clock_event_mode mode, ...@@ -72,10 +72,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)
{ {
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
outb_pit(delta & 0xff , PIT_CH0); /* LSB */ outb_pit(delta & 0xff , PIT_CH0); /* LSB */
outb_pit(delta >> 8 , PIT_CH0); /* MSB */ outb_pit(delta >> 8 , PIT_CH0); /* MSB */
spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
return 0; return 0;
} }
...@@ -130,7 +130,7 @@ static cycle_t pit_read(struct clocksource *cs) ...@@ -130,7 +130,7 @@ static cycle_t pit_read(struct clocksource *cs)
int count; int count;
u32 jifs; u32 jifs;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
/* /*
* Although our caller may have the read side of xtime_lock, * Although our caller may have the read side of xtime_lock,
* this is now a seqlock, and we are cheating in this routine * this is now a seqlock, and we are cheating in this routine
...@@ -176,7 +176,7 @@ static cycle_t pit_read(struct clocksource *cs) ...@@ -176,7 +176,7 @@ static cycle_t pit_read(struct clocksource *cs)
old_count = count; old_count = count;
old_jifs = jifs; old_jifs = jifs;
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
count = (LATCH - 1) - count; count = (LATCH - 1) - count;
......
...@@ -165,12 +165,12 @@ unsigned long read_timer(void) ...@@ -165,12 +165,12 @@ unsigned long read_timer(void)
unsigned long t, flags; unsigned long t, flags;
int i; int i;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
t = jiffies * 11932; t = jiffies * 11932;
outb_p(0, 0x43); outb_p(0, 0x43);
i = inb_p(0x40); i = inb_p(0x40);
i |= inb(0x40) << 8; i |= inb(0x40) << 8;
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
return(t - i); return(t - i);
} }
#endif #endif
......
...@@ -59,11 +59,11 @@ static unsigned int get_time_pit(void) ...@@ -59,11 +59,11 @@ static unsigned int get_time_pit(void)
unsigned long flags; unsigned long flags;
unsigned int count; unsigned int count;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x00, 0x43); outb_p(0x00, 0x43);
count = inb_p(0x40); count = inb_p(0x40);
count |= inb_p(0x40) << 8; count |= inb_p(0x40) << 8;
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
return count; return count;
} }
......
...@@ -146,11 +146,11 @@ static unsigned int get_time_pit(void) ...@@ -146,11 +146,11 @@ static unsigned int get_time_pit(void)
unsigned long flags; unsigned long flags;
unsigned int count; unsigned int count;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x00, 0x43); outb_p(0x00, 0x43);
count = inb_p(0x40); count = inb_p(0x40);
count |= inb_p(0x40) << 8; count |= inb_p(0x40) << 8;
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
return count; return count;
} }
......
...@@ -30,7 +30,7 @@ MODULE_ALIAS("platform:pcspkr"); ...@@ -30,7 +30,7 @@ MODULE_ALIAS("platform:pcspkr");
#include <asm/i8253.h> #include <asm/i8253.h>
#else #else
#include <asm/8253pit.h> #include <asm/8253pit.h>
static DEFINE_SPINLOCK(i8253_lock); static DEFINE_RAW_SPINLOCK(i8253_lock);
#endif #endif
static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 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 ...@@ -50,7 +50,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
if (value > 20 && value < 32767) if (value > 20 && value < 32767)
count = PIT_TICK_RATE / value; count = PIT_TICK_RATE / value;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
if (count) { if (count) {
/* set command for counter 2, 2 byte write */ /* 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 ...@@ -65,7 +65,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c
outb(inb_p(0x61) & 0xFC, 0x61); outb(inb_p(0x61) & 0xFC, 0x61);
} }
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
return 0; return 0;
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <asm/i8253.h> #include <asm/i8253.h>
#else #else
#include <asm/8253pit.h> #include <asm/8253pit.h>
static DEFINE_SPINLOCK(i8253_lock); static DEFINE_RAW_SPINLOCK(i8253_lock);
#endif #endif
#define PCSP_SOUND_VERSION 0x400 /* read 4.00 */ #define PCSP_SOUND_VERSION 0x400 /* read 4.00 */
......
...@@ -21,7 +21,7 @@ static void pcspkr_do_sound(unsigned int count) ...@@ -21,7 +21,7 @@ static void pcspkr_do_sound(unsigned int count)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
if (count) { if (count) {
/* set command for counter 2, 2 byte write */ /* set command for counter 2, 2 byte write */
...@@ -36,7 +36,7 @@ static void pcspkr_do_sound(unsigned int count) ...@@ -36,7 +36,7 @@ static void pcspkr_do_sound(unsigned int count)
outb(inb_p(0x61) & 0xFC, 0x61); outb(inb_p(0x61) & 0xFC, 0x61);
} }
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
} }
void pcspkr_stop_sound(void) void pcspkr_stop_sound(void)
......
...@@ -65,7 +65,7 @@ static u64 pcsp_timer_update(struct snd_pcsp *chip) ...@@ -65,7 +65,7 @@ static u64 pcsp_timer_update(struct snd_pcsp *chip)
timer_cnt = val * CUR_DIV() / 256; timer_cnt = val * CUR_DIV() / 256;
if (timer_cnt && chip->enable) { if (timer_cnt && chip->enable) {
spin_lock_irqsave(&i8253_lock, flags); raw_spin_lock_irqsave(&i8253_lock, flags);
if (!nforce_wa) { if (!nforce_wa) {
outb_p(chip->val61, 0x61); outb_p(chip->val61, 0x61);
outb_p(timer_cnt, 0x42); outb_p(timer_cnt, 0x42);
...@@ -74,7 +74,7 @@ static u64 pcsp_timer_update(struct snd_pcsp *chip) ...@@ -74,7 +74,7 @@ static u64 pcsp_timer_update(struct snd_pcsp *chip)
outb(chip->val61 ^ 2, 0x61); outb(chip->val61 ^ 2, 0x61);
chip->thalf = 1; chip->thalf = 1;
} }
spin_unlock_irqrestore(&i8253_lock, flags); raw_spin_unlock_irqrestore(&i8253_lock, flags);
} }
chip->ns_rem = PCSP_PERIOD_NS(); chip->ns_rem = PCSP_PERIOD_NS();
...@@ -158,10 +158,10 @@ static int pcsp_start_playing(struct snd_pcsp *chip) ...@@ -158,10 +158,10 @@ static int pcsp_start_playing(struct snd_pcsp *chip)
return -EIO; return -EIO;
} }
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
chip->val61 = inb(0x61) | 0x03; chip->val61 = inb(0x61) | 0x03;
outb_p(0x92, 0x43); /* binary, mode 1, LSB only, ch 2 */ outb_p(0x92, 0x43); /* binary, mode 1, LSB only, ch 2 */
spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
atomic_set(&chip->timer_active, 1); atomic_set(&chip->timer_active, 1);
chip->thalf = 0; chip->thalf = 0;
...@@ -178,11 +178,11 @@ static void pcsp_stop_playing(struct snd_pcsp *chip) ...@@ -178,11 +178,11 @@ static void pcsp_stop_playing(struct snd_pcsp *chip)
return; return;
atomic_set(&chip->timer_active, 0); atomic_set(&chip->timer_active, 0);
spin_lock(&i8253_lock); raw_spin_lock(&i8253_lock);
/* restore the timer */ /* restore the timer */
outb_p(0xb6, 0x43); /* binary, mode 3, LSB/MSB, ch 2 */ outb_p(0xb6, 0x43); /* binary, mode 3, LSB/MSB, ch 2 */
outb(chip->val61 & 0xFC, 0x61); outb(chip->val61 & 0xFC, 0x61);
spin_unlock(&i8253_lock); raw_spin_unlock(&i8253_lock);
} }
/* /*
......
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