*/
#include <linux/init.h>
+#include <linux/spinlock.h>
#include "sound_config.h"
#include "pas2.h"
+extern spinlock_t lock;
+
static int midi_busy = 0, input_opened = 0;
static int my_dev;
pas_write(0x20 | 0x40,
0x178b);
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock, flags);
if ((err = pas_set_intr(0x10)) < 0)
{
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
return err;
}
/*
pas_write(0xff, 0x1B88);
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
midi_busy = 1;
qlen = qhead = qtail = 0;
* Drain the local queue first
*/
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock, flags);
while (qlen && dump_to_midi(tmp_queue[qhead]))
{
qhead++;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
/*
* Output the byte if the local queue is empty.
if (qlen >= 256)
return 0; /* Local queue full */
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&lock, flags);
tmp_queue[qtail] = midi_byte;
qlen++;
qtail++;
- restore_flags(flags);
+ spin_unlock_irqrestore(&lock, flags);
return 1;
}
{
unsigned char stat;
int i, incount;
- unsigned long flags;
stat = pas_read(0x1B88);
}
if (stat & (0x08 | 0x10))
{
- save_flags(flags);
- cli();
+ spin_lock(&lock);/* called in irq context */
while (qlen && dump_to_midi(tmp_queue[qhead]))
{
qhead++;
}
- restore_flags(flags);
+ spin_unlock(&lock);
}
if (stat & 0x40)
{