(revised): spinlocks in SoundBlaster
PATCH 1/1 (revised): spinlocks in SoundBlaster
Hi,
I compiled an SMP kernel on my UP box to test my spinlock patch properly. Suffice to say that here is a revised version (ahem! ;-)
The other patches I posted seem to be OK.
Cheers,
Chris
drivers/sound/sb.h renamed from drivers/sound/sb.h.orig +2 -0
@@ -137,6 +137,8 @@void (*midi_input_intr) (int dev,unsigned char data);void *midi_irq_cookie;/* IRQ cookie for the midi */ +spinlock_t lock; +struct sb_module_options sbmo;/* Module options */ } sb_devc;
drivers/sound/sb_audio.c renamed from drivers/sound/sb_audio.c.orig +31 -41
229 lines not on this page · raw message
drivers/sound/sb_ess.c renamed from drivers/sound/sb_ess.c.orig +9 -12
@@ -186,6 +186,7 @@*/ #include <linux/delay.h> +#include <linux/spinlock.h> #include "sound_config.h" #include "sb_mixer.h"
@@ -524,10 +525,9 @@unsigned long flags;sb_devc *devc = audio_devs[dev]->devc; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);sb_dsp_reset (devc); -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags);/* * Audio 2 may still be operational! Creates awful sounds!
@@ -969,8 +969,7 @@unsigned int val;unsigned long flags; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);outb (((unsigned char ) (0x40 &0xff )),MIXER_ADDR );udelay (20 );
@@ -978,7 +977,7 @@udelay (20 ); val |=inb (MIXER_DATA );udelay (20 ); -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags);return val; }
@@ -1565,8 +1564,7 @@printk (KERN_INFO "FKS: write mixer %x: %x\n" , port, value);#endif -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);if (port >=0xa0 ) {ess_write (devc, port, value); }else {
@@ -1576,7 +1574,7 @@outb (((unsigned char ) (value &0xff )),MIXER_DATA );udelay (20 ); }; -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags); }unsigned int ess_getmixer (sb_devc * devc,unsigned int port)
@@ -1584,8 +1582,7 @@unsigned int val;unsigned long flags; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);if (port >=0xa0 ) { val =ess_read (devc, port);
@@ -1596,7 +1593,7 @@ val =inb (MIXER_DATA );udelay (20 ); } -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags);return val; }
drivers/sound/sb_midi.c renamed from drivers/sound/sb_midi.c.orig +9 -10
@@ -11,6 +11,8 @@* for more info. */ +#include <linux/spinlock.h> +#include "sound_config.h" #include "sb.h"
@@ -36,15 +38,14 @@if (devc ==NULL )return -ENXIO ; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);if (devc->opened) { -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags);return -EBUSY ; } devc->opened =1 ; -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags); devc->irq_mode =IMODE_MIDI ; devc->midi_broken =0 ;
@@ -74,13 +75,12 @@if (devc ==NULL )return ; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags);sb_dsp_reset (devc); devc->intr_active =0 ; devc->input_opened =0 ; devc->opened =0 ; -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags); }static int sb_midi_out (int dev,unsigned char midi_byte)
@@ -131,14 +131,13 @@if (devc ==NULL )return ; -save_flags (flags); -cli (); +spin_lock_irqsave (&devc->lock, flags); data =inb (DSP_READ );if (devc->input_opened) devc->midi_input_intr (devc->my_mididev, data); -restore_flags (flags); +spin_unlock_irqrestore (&devc->lock, flags); }#define MIDI_SYNTH_NAME "Sound Blaster Midi"
drivers/sound/sb_common.c renamed from drivers/sound/sb_common.c.orig +25 -24
168 lines not on this page · raw message
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/