Commit 18e131d1 authored by Peter Wächtler's avatar Peter Wächtler Committed by Jeff Garzik

[PATCH] oss sound cli cleanup

More cleanups for the OSS sound modules
parent dd140c87
......@@ -826,37 +826,48 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
if (!(audio_devs[dev]->flags & DMA_DUPLEX) && (bits & PCM_ENABLE_INPUT) &&
(bits & PCM_ENABLE_OUTPUT))
return -EINVAL;
spin_lock_irqsave(&dmap->lock,flags);
changed = audio_devs[dev]->enable_bits ^ bits;
if ((changed & bits) & PCM_ENABLE_INPUT && audio_devs[dev]->go)
if (bits & PCM_ENABLE_INPUT)
{
reorganize_buffers(dev, dmap_in, 1);
if ((err = audio_devs[dev]->d->prepare_for_input(dev,
dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
spin_unlock_irqrestore(&dmap->lock,flags);
return -err;
}
dmap_in->dma_mode = DMODE_INPUT;
audio_devs[dev]->enable_bits = bits;
DMAbuf_activate_recording(dev, dmap_in);
spin_lock_irqsave(&dmap_in->lock,flags);
changed = (audio_devs[dev]->enable_bits ^ bits) & PCM_ENABLE_INPUT;
if (changed && audio_devs[dev]->go)
{
reorganize_buffers(dev, dmap_in, 1);
if ((err = audio_devs[dev]->d->prepare_for_input(dev,
dmap_in->fragment_size, dmap_in->nbufs)) < 0) {
spin_unlock_irqrestore(&dmap_in->lock,flags);
return -err;
}
dmap_in->dma_mode = DMODE_INPUT;
audio_devs[dev]->enable_bits |= PCM_ENABLE_INPUT;
DMAbuf_activate_recording(dev, dmap_in);
} else
audio_devs[dev]->enable_bits &= ~PCM_ENABLE_INPUT;
spin_unlock_irqrestore(&dmap_in->lock,flags);
}
if ((changed & bits) & PCM_ENABLE_OUTPUT &&
(dmap_out->mapping_flags & DMA_MAP_MAPPED || dmap_out->qlen > 0) &&
audio_devs[dev]->go)
if (bits & PCM_ENABLE_OUTPUT)
{
if (!(dmap_out->flags & DMA_ALLOC_DONE))
reorganize_buffers(dev, dmap_out, 0);
dmap_out->dma_mode = DMODE_OUTPUT;
audio_devs[dev]->enable_bits = bits;
dmap_out->counts[dmap_out->qhead] = dmap_out->fragment_size;
DMAbuf_launch_output(dev, dmap_out);
spin_lock_irqsave(&dmap_out->lock,flags);
changed = (audio_devs[dev]->enable_bits ^ bits) & PCM_ENABLE_OUTPUT;
if (changed &&
(dmap_out->mapping_flags & DMA_MAP_MAPPED || dmap_out->qlen > 0) &&
audio_devs[dev]->go)
{
if (!(dmap_out->flags & DMA_ALLOC_DONE))
reorganize_buffers(dev, dmap_out, 0);
dmap_out->dma_mode = DMODE_OUTPUT;
audio_devs[dev]->enable_bits |= PCM_ENABLE_OUTPUT;
dmap_out->counts[dmap_out->qhead] = dmap_out->fragment_size;
DMAbuf_launch_output(dev, dmap_out);
} else
audio_devs[dev]->enable_bits &= ~PCM_ENABLE_OUTPUT;
spin_unlock_irqrestore(&dmap_out->lock,flags);
}
audio_devs[dev]->enable_bits = bits;
#if 0
if (changed && audio_devs[dev]->d->trigger)
audio_devs[dev]->d->trigger(dev, bits * audio_devs[dev]->go);
#endif
spin_unlock_irqrestore(&dmap->lock,flags);
/* Falls through... */
case SNDCTL_DSP_GETTRIGGER:
......@@ -873,7 +884,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
case SNDCTL_DSP_GETIPTR:
if (!(audio_devs[dev]->open_mode & OPEN_READ))
return -EINVAL;
spin_lock_irqsave(&dmap->lock,flags);
spin_lock_irqsave(&dmap_in->lock,flags);
cinfo.bytes = dmap_in->byte_counter;
cinfo.ptr = DMAbuf_get_buffer_pointer(dev, dmap_in, DMODE_INPUT) & ~3;
if (cinfo.ptr < dmap_in->fragment_size && dmap_in->qtail != 0)
......@@ -882,7 +893,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
cinfo.bytes += cinfo.ptr;
if (dmap_in->mapping_flags & DMA_MAP_MAPPED)
dmap_in->qlen = 0; /* Reset interrupt counter */
spin_unlock_irqrestore(&dmap->lock,flags);
spin_unlock_irqrestore(&dmap_in->lock,flags);
if (copy_to_user(arg, &cinfo, sizeof(cinfo)))
return -EFAULT;
return 0;
......@@ -891,7 +902,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
if (!(audio_devs[dev]->open_mode & OPEN_WRITE))
return -EINVAL;
spin_lock_irqsave(&dmap->lock,flags);
spin_lock_irqsave(&dmap_out->lock,flags);
cinfo.bytes = dmap_out->byte_counter;
cinfo.ptr = DMAbuf_get_buffer_pointer(dev, dmap_out, DMODE_OUTPUT) & ~3;
if (cinfo.ptr < dmap_out->fragment_size && dmap_out->qhead != 0)
......@@ -900,7 +911,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
cinfo.bytes += cinfo.ptr;
if (dmap_out->mapping_flags & DMA_MAP_MAPPED)
dmap_out->qlen = 0; /* Reset interrupt counter */
spin_unlock_irqrestore(&dmap->lock,flags);
spin_unlock_irqrestore(&dmap_out->lock,flags);
if (copy_to_user(arg, &cinfo, sizeof(cinfo)))
return -EFAULT;
return 0;
......@@ -913,7 +924,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
ret=0;
break;
}
spin_lock_irqsave(&dmap->lock,flags);
spin_lock_irqsave(&dmap_out->lock,flags);
/* Compute number of bytes that have been played */
count = DMAbuf_get_buffer_pointer (dev, dmap_out, DMODE_OUTPUT);
if (count < dmap_out->fragment_size && dmap_out->qhead != 0)
......@@ -923,7 +934,7 @@ int dma_ioctl(int dev, unsigned int cmd, caddr_t arg)
count = dmap_out->user_counter - count;
if (count < 0)
count = 0;
spin_unlock_irqrestore(&dmap->lock,flags);
spin_unlock_irqrestore(&dmap_out->lock,flags);
ret = count;
break;
......
......@@ -166,6 +166,7 @@ struct sound_settings {
int treble;
int gain;
int minDev; /* minor device number currently open */
spinlock_t lock;
};
extern struct sound_settings dmasound;
......
......@@ -19,7 +19,7 @@
#include <linux/init.h>
#include <linux/soundcard.h>
#include <linux/mm.h>
#include <linux/spinlock.h>
#include <asm/pgalloc.h>
#include <asm/uaccess.h>
#include <asm/atariints.h>
......@@ -1262,7 +1262,7 @@ static void AtaInterrupt(int irq, void *dummy, struct pt_regs *fp)
return;
}
#endif
spin_lock(&dmasound.lock);
if (write_sq_ignore_int && is_falcon) {
/* ++TeSche: Falcon only: ignore first irq because it comes
* immediately after starting a frame. after that, irqs come
......@@ -1314,6 +1314,7 @@ static void AtaInterrupt(int irq, void *dummy, struct pt_regs *fp)
/* We are not playing after AtaPlay(), so there
is nothing to play any more. Wake up a process
waiting for audio output to drain. */
spin_unlock(&dmasound.lock);
}
......@@ -1349,14 +1350,15 @@ static void __init FalconMixerInit(void)
static int AtaMixerIoctl(u_int cmd, u_long arg)
{
int data;
unsigned long flags;
switch (cmd) {
case SOUND_MIXER_READ_SPEAKER:
if (is_falcon || MACH_IS_TT) {
int porta;
cli();
spin_lock_irqsave(&dmasound.lock, flags);
sound_ym.rd_data_reg_sel = 14;
porta = sound_ym.rd_data_reg_sel;
sti();
spin_unlock_irqrestore(&dmasound.lock, flags);
return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
}
break;
......@@ -1367,12 +1369,12 @@ static int AtaMixerIoctl(u_int cmd, u_long arg)
if (is_falcon || MACH_IS_TT) {
int porta;
IOCTL_IN(arg, data);
cli();
spin_lock_irqsave(&dmasound.lock, flags);
sound_ym.rd_data_reg_sel = 14;
porta = (sound_ym.rd_data_reg_sel & ~0x40) |
(data < 50 ? 0x40 : 0);
sound_ym.wd_data = porta;
sti();
spin_unlock_irqrestore(&dmasound.lock, flags);
return IOCTL_OUT(arg, porta & 0x40 ? 0 : 100);
}
}
......
......@@ -66,6 +66,7 @@
#include <linux/tty.h>
#include <linux/vt_kern.h>
#include <linux/irq.h>
#include <linux/spinlock.h>
#include <linux/kmod.h>
#include <asm/semaphore.h>
#ifdef CONFIG_ADB_CUDA
......@@ -397,6 +398,7 @@ read_audio_gpio(int gpio_addr)
static void
headphone_intr(int irq, void *devid, struct pt_regs *regs)
{
spin_lock(&dmasound.lock);
if (read_audio_gpio(gpio_headphone_detect) == gpio_headphone_detect_pol) {
printk(KERN_INFO "Audio jack plugged, muting speakers.\n");
write_audio_gpio(gpio_amp_mute, gpio_amp_mute_pol);
......@@ -406,6 +408,7 @@ headphone_intr(int irq, void *devid, struct pt_regs *regs)
write_audio_gpio(gpio_amp_mute, !gpio_amp_mute_pol);
write_audio_gpio(gpio_headphone_mute, gpio_headphone_mute_pol);
}
spin_unlock(&dmasound.lock);
}
......@@ -804,7 +807,7 @@ static void __PMacPlay(void)
/* CHECK: how much of this *really* needs IRQs masked? */
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
count = 300 ; /* > two cycles at the lowest sample rate */
/* what we want to send next */
......@@ -871,7 +874,7 @@ static void __PMacPlay(void)
out_le32(&awacs_txdma->control, ((RUN|WAKE) << 16) + (RUN|WAKE));
++write_sq.active;
}
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
}
static void PMacPlay(void)
......@@ -889,14 +892,14 @@ static void PMacRecord(void)
if (read_sq.active)
return;
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
/* This is all we have to do......Just start it up.
*/
out_le32(&awacs_rxdma->control, ((RUN|WAKE) << 16) + (RUN|WAKE));
read_sq.active = 1;
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
}
/* if the TX status comes up "DEAD" - reported on some Power Computing machines
......@@ -929,6 +932,7 @@ pmac_awacs_tx_intr(int irq, void *devid, struct pt_regs *regs)
/* != 0 when we are dealing with a DEAD xfer */
static int emergency_in_use = 0 ;
spin_lock(&dmasound.lock);
while (write_sq.active > 0) { /* we expect to have done something*/
if (emergency_in_use) /* we are dealing with DEAD xfer */
cp = emergency_dbdma_cmd ;
......@@ -1004,6 +1008,7 @@ printk("dmasound_pmac: tx-irq: xfer died - patching it up...\n") ;
/* make the wake-on-empty conditional on syncing */
if (!write_sq.active && (write_sq.syncing & 1))
WAKE_UP(write_sq.sync_queue); /* any time we're empty */
spin_unlock(&dmasound.lock);
}
......@@ -1025,6 +1030,7 @@ pmac_awacs_rx_intr(int irq, void *devid, struct pt_regs *regs)
if (read_sq.active == 0)
return;
spin_lock(&dmasound.lock);
/* Check multiple buffers in case we were held off from
* interrupt processing for a long time. Geeze, I really hope
* this doesn't happen.
......@@ -1056,6 +1062,7 @@ printk("dmasound_pmac: rx-irq: DIED - attempting resurection\n");
/* should complete clearing the DEAD status */
out_le32(&awacs_rxdma->control,
((RUN|WAKE) << 16) + (RUN|WAKE));
spin_unlock(&dmasound.lock);
return; /* try this block again */
}
/* Clear status and move on to next buffer.
......@@ -1083,13 +1090,16 @@ printk("dmasound_pmac: rx-irq: DIED - attempting resurection\n");
}
WAKE_UP(read_sq.action_queue);
spin_unlock(&dmasound.lock);
}
static void
pmac_awacs_intr(int irq, void *devid, struct pt_regs *regs)
{
int ctrl = in_le32(&awacs->control);
int ctrl;
spin_lock(&dmasound.lock);
ctrl = in_le32(&awacs->control);
if (ctrl & MASK_PORTCHG) {
/* do something when headphone is plugged/unplugged? */
......@@ -1102,6 +1112,7 @@ pmac_awacs_intr(int irq, void *devid, struct pt_regs *regs)
}
/* Writing 1s to the CNTLERR and PORTCHG bits clears them... */
out_le32(&awacs->control, ctrl);
spin_unlock(&dmasound.lock);
}
static void
......@@ -1125,7 +1136,7 @@ static void awacs_nosound(unsigned long xx)
unsigned long flags;
int count = 600 ; /* > four samples at lowest rate */
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
if (beep_playing) {
st_le16(&beep_dbdma_cmd->command, DBDMA_STOP);
out_le32(&awacs_txdma->control, (RUN|PAUSE|FLUSH|WAKE) << 16);
......@@ -1141,7 +1152,7 @@ static void awacs_nosound(unsigned long xx)
out_le32(&awacs->byteswap, 0);
beep_playing = 0;
}
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
}
static struct timer_list beep_timer = {
......@@ -1189,19 +1200,19 @@ static void awacs_mksound(unsigned int hz, unsigned int ticks)
return;
#endif
}
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
del_timer(&beep_timer);
if (ticks) {
beep_timer.expires = jiffies + ticks;
add_timer(&beep_timer);
}
if (beep_playing || write_sq.active || beep_buf == NULL) {
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
return; /* too hard, sorry :-( */
}
beep_playing = 1;
st_le16(&beep_dbdma_cmd->command, OUTPUT_MORE + BR_ALWAYS);
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
if (hz == beep_hz_cache && beep_vol == beep_volume_cache) {
nsamples = beep_nsamples_cache;
......@@ -1227,7 +1238,7 @@ static void awacs_mksound(unsigned int hz, unsigned int ticks)
st_le32(&beep_dbdma_cmd->phy_addr, virt_to_bus(beep_buf));
awacs_beep_state = 1;
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
if (beep_playing) { /* i.e. haven't been terminated already */
int count = 300 ;
out_le32(&awacs_txdma->control, (RUN|WAKE|FLUSH|PAUSE) << 16);
......@@ -1242,7 +1253,7 @@ static void awacs_mksound(unsigned int hz, unsigned int ticks)
(void)in_le32(&awacs_txdma->status);
out_le32(&awacs_txdma->control, RUN | (RUN << 16));
}
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
}
/* used in init and for wake-up */
......@@ -1430,7 +1441,7 @@ awacs_burgundy_rcw(unsigned addr)
unsigned long flags;
/* should have timeouts here */
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
out_le32(&awacs->codec_ctrl, addr + 0x100000);
awacs_burgundy_busy_wait();
......@@ -1452,7 +1463,7 @@ awacs_burgundy_rcw(unsigned addr)
awacs_burgundy_extend_wait();
val += ((in_le32(&awacs->codec_stat)>>4) & 0xff) <<24;
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
return val;
}
......@@ -1472,14 +1483,14 @@ awacs_burgundy_rcb(unsigned addr)
unsigned long flags;
/* should have timeouts here */
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
out_le32(&awacs->codec_ctrl, addr + 0x100000);
awacs_burgundy_busy_wait();
awacs_burgundy_extend_wait();
val += (in_le32(&awacs->codec_stat) >> 4) & 0xff;
restore_flags(flags);
spin_unlock_irqrestore(&dmasound.lock, flags);
return val;
}
......
......@@ -597,9 +597,9 @@ static ssize_t sq_write(struct file *file, const char *src, size_t uLeft,
is drained - and if we get here in time then it does not apply.
*/
save_flags(flags) ; cli() ;
spin_lock_irqsave(&dmasound.lock, flags);
write_sq.syncing &= ~2 ; /* take out POST status */
restore_flags(flags) ;
spin_unlock_irqrestore(&dmasound.lock, flags);
if (write_sq.count > 0 &&
(bLeft = write_sq.block_size-write_sq.rear_size) > 0) {
......@@ -1347,6 +1347,7 @@ static int __init sq_init(void)
if (dmasound.mach.record)
sq_fops.read = sq_read ;
#endif
spin_lock_init(&dmasound.lock);
sq_unit = register_sound_dsp(&sq_fops, -1);
if (sq_unit < 0) {
printk(KERN_ERR "dmasound_core: couldn't register fops\n") ;
......
......@@ -459,28 +459,32 @@ static void Q40Play(void)
*/
return;
}
save_flags(flags); cli();
spin_lock_irqsave(&dmasound.lock, flags);
Q40PlayNextFrame(1);
restore_flags(flags);
spin_unlock_irqrestore_flags(&dmasound.lock, flags);
}
static void Q40StereoInterrupt(int irq, void *dummy, struct pt_regs *fp)
{
spin_lock(&dmasound.lock);
if (q40_sc>1){
*DAC_LEFT=*q40_pp++;
*DAC_RIGHT=*q40_pp++;
q40_sc -=2;
master_outb(1,SAMPLE_CLEAR_REG);
}else Q40Interrupt();
spin_unlock(&dmasound.lock);
}
static void Q40MonoInterrupt(int irq, void *dummy, struct pt_regs *fp)
{
spin_lock(&dmasound.lock);
if (q40_sc>0){
*DAC_LEFT=*q40_pp;
*DAC_RIGHT=*q40_pp++;
q40_sc --;
master_outb(1,SAMPLE_CLEAR_REG);
}else Q40Interrupt();
spin_unlock(&dmasound.lock);
}
static void Q40Interrupt(void)
{
......
......@@ -16,6 +16,7 @@
*/
#include <linux/init.h>
#include <linux/spinlock.h>
#include "sound_config.h"
#include "gus.h"
......@@ -25,7 +26,7 @@ static int midi_busy = 0, input_opened = 0;
static int my_dev;
static int output_used = 0;
static volatile unsigned char gus_midi_control;
static spinlock_t lock=SPIN_LOCK_UNLOCKED;
static void (*midi_input_intr) (int dev, unsigned char data);
static unsigned char tmp_queue[256];
......@@ -75,8 +76,7 @@ static int dump_to_midi(unsigned char midi_byte)
output_used = 1;
save_flags(flags);
cli();
spin_lock_irqsave(&lock, flags);
if (GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY)
{
......@@ -92,7 +92,7 @@ static int dump_to_midi(unsigned char midi_byte)
outb((gus_midi_control), u_MidiControl);
}
restore_flags(flags);
spin_unlock_irqrestore(&lock,flags);
return ok;
}
......@@ -113,16 +113,14 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
/*
* Drain the local queue first
*/
save_flags(flags);
cli();
spin_lock_irqsave(&lock, flags);
while (qlen && dump_to_midi(tmp_queue[qhead]))
{
qlen--;
qhead++;
}
restore_flags(flags);
spin_unlock_irqrestore(&lock,flags);
/*
* Output the byte if the local queue is empty.
......@@ -142,14 +140,13 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
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;
}
......@@ -174,15 +171,14 @@ static int gus_midi_buffer_status(int dev)
if (!output_used)
return 0;
save_flags(flags);
cli();
spin_lock_irqsave(&lock, flags);
if (qlen && dump_to_midi(tmp_queue[qhead]))
{
qlen--;
qhead++;
}
restore_flags(flags);
spin_unlock_irqrestore(&lock,flags);
return (qlen > 0) | !(GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY);
}
......@@ -226,11 +222,9 @@ void __init gus_midi_init(struct address_info *hw_config)
void gus_midi_interrupt(int dummy)
{
volatile unsigned char stat, data;
unsigned long flags;
int timeout = 10;
save_flags(flags);
cli();
spin_lock(&lock);
while (timeout-- > 0 && (stat = GUS_MIDI_STATUS()) & (MIDI_RCV_FULL | MIDI_XMIT_EMPTY))
{
......@@ -258,5 +252,5 @@ void gus_midi_interrupt(int dummy)
}
}
}
restore_flags(flags);
spin_unlock(&lock);
}
This diff is collapsed.
......@@ -15,6 +15,7 @@
* Bartlomiej Zolnierkiewicz : added __init to ics2101_mixer_init()
*/
#include <linux/init.h>
#include <linux/spinlock.h>
#include "sound_config.h"
#include <linux/ultrasound.h>
......@@ -28,6 +29,7 @@
extern int *gus_osp;
extern int gus_base;
extern spinlock_t lock;
static int volumes[ICS_MIXDEVS];
static int left_fix[ICS_MIXDEVS] =
{1, 1, 1, 2, 1, 2};
......@@ -85,13 +87,12 @@ static void write_mix(int dev, int chn, int vol)
attn_addr |= 0x03;
}
save_flags(flags);
cli();
spin_lock_irqsave(&lock, flags);
outb((ctrl_addr), u_MixSelect);
outb((selector[dev]), u_MixData);
outb((attn_addr), u_MixSelect);
outb(((unsigned char) vol), u_MixData);
restore_flags(flags);
spin_unlock_irqrestore(&lock,flags);
}
static int set_volumes(int dev, int vol)
......
......@@ -3,7 +3,7 @@ typedef struct vmidi_devc {
/* State variables */
int opened;
spinlock_t lock;
/* MIDI fields */
int my_mididev;
......
......@@ -50,6 +50,7 @@
*/
#include <linux/init.h>
#include <linux/spinlock.h>
#include "sound_config.h"
#include <linux/wavefront.h>
......@@ -79,6 +80,7 @@ static struct wf_mpu_config *phys_dev = &devs[0];
static struct wf_mpu_config *virt_dev = &devs[1];
static void start_uart_mode (void);
static spinlock_t lock=SPIN_LOCK_UNLOCKED;
#define OUTPUT_READY 0x40
#define INPUT_AVAIL 0x80
......@@ -365,8 +367,8 @@ wf_mpuintr (int irq, void *dev_id, struct pt_regs *dummy)
}
if (mi->m_busy) return;
spin_lock(&lock);
mi->m_busy = 1;
sti ();
if (!input_dev) {
input_dev = physical_dev;
......@@ -406,6 +408,7 @@ wf_mpuintr (int irq, void *dev_id, struct pt_regs *dummy)
} while (input_avail() && n-- > 0);
mi->m_busy = 0;
spin_unlock(&lock);
}
static int
......@@ -486,18 +489,17 @@ wf_mpu_out (int dev, unsigned char midi_byte)
for (timeout = 30000; timeout > 0 && !output_ready ();
timeout--);
save_flags (flags);
cli ();
spin_lock_irqsave(&lock,flags);
if (!output_ready ()) {
printk (KERN_WARNING "WF-MPU: Send switch "
"byte timeout\n");
restore_flags (flags);
spin_unlock_irqrestore(&lock,flags);
return 0;
}
write_data (switchch);
restore_flags (flags);
spin_unlock_irqrestore(&lock,flags);
}
lastoutdev = dev;
......@@ -511,16 +513,15 @@ wf_mpu_out (int dev, unsigned char midi_byte)
for (timeout = 30000; timeout > 0 && !output_ready (); timeout--);
save_flags (flags);
cli ();
spin_lock_irqsave(&lock,flags);
if (!output_ready ()) {
spin_unlock_irqrestore(&lock,flags);
printk (KERN_WARNING "WF-MPU: Send data timeout\n");
restore_flags (flags);
return 0;
}
write_data (midi_byte);
restore_flags (flags);
spin_unlock_irqrestore(&lock,flags);
return 1;
}
......@@ -768,14 +769,13 @@ virtual_midi_disable (void)
{
unsigned long flags;
save_flags (flags);
cli();
spin_lock_irqsave(&lock,flags);
wf_mpu_close (virt_dev->devno);
/* no synth on virt_dev, so no need to call wf_mpu_synth_close() */
phys_dev->isvirtual = 0;
restore_flags (flags);
spin_unlock_irqrestore(&lock,flags);
return 0;
}
......@@ -858,8 +858,7 @@ start_uart_mode (void)
int ok, i;
unsigned long flags;
save_flags (flags);
cli ();
spin_lock_irqsave(&lock,flags);
/* XXX fix me */
......@@ -875,6 +874,6 @@ start_uart_mode (void)
}
}
restore_flags (flags);
spin_unlock_irqrestore(&lock,flags);
}
#endif
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