diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-09-14 15:53:41 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-09-14 17:14:50 -0400 |
commit | 645ef9ef1fc0ff70456495b1e21d3420b7b08541 (patch) | |
tree | f5e5df85076f397690437f09cb56688b06a03dbf /sound | |
parent | 7b6c3a34e93aafc5dd9adc7dee87c7fa61d8bdbb (diff) |
sound: autoconvert trivial BKL users to private mutex
The usage of the BKL in the OSS sound drivers is
trivial, and each of them only locks against itself,
so it can be turned into per-driver mutexes.
This is the script that was used for the conversion:
file=$1
name=$2
if grep -q lock_kernel ${file} ; then
if grep -q 'include.*linux.mutex.h' ${file} ; then
sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
else
sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
fi
sed -i ${file} \
-e "/^#include.*linux.mutex.h/,$ {
1,/^\(static\|int\|long\)/ {
/^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
} }" \
-e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
-e '/[ ]*cycle_kernel_lock();/d'
else
sed -i -e '/include.*\<smp_lock.h\>/d' ${file} \
-e '/cycle_kernel_lock()/d'
fi
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/oss/au1550_ac97.c | 30 | ||||
-rw-r--r-- | sound/oss/dmasound/dmasound_core.c | 41 | ||||
-rw-r--r-- | sound/oss/msnd_pinnacle.c | 15 | ||||
-rw-r--r-- | sound/oss/sh_dac_audio.c | 13 | ||||
-rw-r--r-- | sound/oss/soundcard.c | 41 | ||||
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 20 | ||||
-rw-r--r-- | sound/oss/vwsnd.c | 30 |
7 files changed, 97 insertions, 93 deletions
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 8a12621d8b3a..a8f626d99c5b 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/sound.h> | 43 | #include <linux/sound.h> |
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/soundcard.h> | 45 | #include <linux/soundcard.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/init.h> | 46 | #include <linux/init.h> |
48 | #include <linux/interrupt.h> | 47 | #include <linux/interrupt.h> |
49 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
@@ -77,6 +76,7 @@ | |||
77 | /* Boot options | 76 | /* Boot options |
78 | * 0 = no VRA, 1 = use VRA if codec supports it | 77 | * 0 = no VRA, 1 = use VRA if codec supports it |
79 | */ | 78 | */ |
79 | static DEFINE_MUTEX(au1550_ac97_mutex); | ||
80 | static int vra = 1; | 80 | static int vra = 1; |
81 | module_param(vra, bool, 0); | 81 | module_param(vra, bool, 0); |
82 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 82 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
@@ -798,9 +798,9 @@ au1550_llseek(struct file *file, loff_t offset, int origin) | |||
798 | static int | 798 | static int |
799 | au1550_open_mixdev(struct inode *inode, struct file *file) | 799 | au1550_open_mixdev(struct inode *inode, struct file *file) |
800 | { | 800 | { |
801 | lock_kernel(); | 801 | mutex_lock(&au1550_ac97_mutex); |
802 | file->private_data = &au1550_state; | 802 | file->private_data = &au1550_state; |
803 | unlock_kernel(); | 803 | mutex_unlock(&au1550_ac97_mutex); |
804 | return 0; | 804 | return 0; |
805 | } | 805 | } |
806 | 806 | ||
@@ -824,9 +824,9 @@ au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) | |||
824 | struct ac97_codec *codec = s->codec; | 824 | struct ac97_codec *codec = s->codec; |
825 | int ret; | 825 | int ret; |
826 | 826 | ||
827 | lock_kernel(); | 827 | mutex_lock(&au1550_ac97_mutex); |
828 | ret = mixdev_ioctl(codec, cmd, arg); | 828 | ret = mixdev_ioctl(codec, cmd, arg); |
829 | unlock_kernel(); | 829 | mutex_unlock(&au1550_ac97_mutex); |
830 | 830 | ||
831 | return ret; | 831 | return ret; |
832 | } | 832 | } |
@@ -1255,7 +1255,7 @@ au1550_mmap(struct file *file, struct vm_area_struct *vma) | |||
1255 | unsigned long size; | 1255 | unsigned long size; |
1256 | int ret = 0; | 1256 | int ret = 0; |
1257 | 1257 | ||
1258 | lock_kernel(); | 1258 | mutex_lock(&au1550_ac97_mutex); |
1259 | mutex_lock(&s->sem); | 1259 | mutex_lock(&s->sem); |
1260 | if (vma->vm_flags & VM_WRITE) | 1260 | if (vma->vm_flags & VM_WRITE) |
1261 | db = &s->dma_dac; | 1261 | db = &s->dma_dac; |
@@ -1283,7 +1283,7 @@ au1550_mmap(struct file *file, struct vm_area_struct *vma) | |||
1283 | db->mapped = 1; | 1283 | db->mapped = 1; |
1284 | out: | 1284 | out: |
1285 | mutex_unlock(&s->sem); | 1285 | mutex_unlock(&s->sem); |
1286 | unlock_kernel(); | 1286 | mutex_unlock(&au1550_ac97_mutex); |
1287 | return ret; | 1287 | return ret; |
1288 | } | 1288 | } |
1289 | 1289 | ||
@@ -1781,9 +1781,9 @@ au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1781 | { | 1781 | { |
1782 | int ret; | 1782 | int ret; |
1783 | 1783 | ||
1784 | lock_kernel(); | 1784 | mutex_lock(&au1550_ac97_mutex); |
1785 | ret = au1550_ioctl(file, cmd, arg); | 1785 | ret = au1550_ioctl(file, cmd, arg); |
1786 | unlock_kernel(); | 1786 | mutex_unlock(&au1550_ac97_mutex); |
1787 | 1787 | ||
1788 | return ret; | 1788 | return ret; |
1789 | } | 1789 | } |
@@ -1804,7 +1804,7 @@ au1550_open(struct inode *inode, struct file *file) | |||
1804 | #endif | 1804 | #endif |
1805 | 1805 | ||
1806 | file->private_data = s; | 1806 | file->private_data = s; |
1807 | lock_kernel(); | 1807 | mutex_lock(&au1550_ac97_mutex); |
1808 | /* wait for device to become free */ | 1808 | /* wait for device to become free */ |
1809 | mutex_lock(&s->open_mutex); | 1809 | mutex_lock(&s->open_mutex); |
1810 | while (s->open_mode & file->f_mode) { | 1810 | while (s->open_mode & file->f_mode) { |
@@ -1861,7 +1861,7 @@ au1550_open(struct inode *inode, struct file *file) | |||
1861 | out: | 1861 | out: |
1862 | mutex_unlock(&s->open_mutex); | 1862 | mutex_unlock(&s->open_mutex); |
1863 | out2: | 1863 | out2: |
1864 | unlock_kernel(); | 1864 | mutex_unlock(&au1550_ac97_mutex); |
1865 | return ret; | 1865 | return ret; |
1866 | } | 1866 | } |
1867 | 1867 | ||
@@ -1870,12 +1870,12 @@ au1550_release(struct inode *inode, struct file *file) | |||
1870 | { | 1870 | { |
1871 | struct au1550_state *s = file->private_data; | 1871 | struct au1550_state *s = file->private_data; |
1872 | 1872 | ||
1873 | lock_kernel(); | 1873 | mutex_lock(&au1550_ac97_mutex); |
1874 | 1874 | ||
1875 | if (file->f_mode & FMODE_WRITE) { | 1875 | if (file->f_mode & FMODE_WRITE) { |
1876 | unlock_kernel(); | 1876 | mutex_unlock(&au1550_ac97_mutex); |
1877 | drain_dac(s, file->f_flags & O_NONBLOCK); | 1877 | drain_dac(s, file->f_flags & O_NONBLOCK); |
1878 | lock_kernel(); | 1878 | mutex_lock(&au1550_ac97_mutex); |
1879 | } | 1879 | } |
1880 | 1880 | ||
1881 | mutex_lock(&s->open_mutex); | 1881 | mutex_lock(&s->open_mutex); |
@@ -1892,7 +1892,7 @@ au1550_release(struct inode *inode, struct file *file) | |||
1892 | s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); | 1892 | s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE)); |
1893 | mutex_unlock(&s->open_mutex); | 1893 | mutex_unlock(&s->open_mutex); |
1894 | wake_up(&s->open_wait); | 1894 | wake_up(&s->open_wait); |
1895 | unlock_kernel(); | 1895 | mutex_unlock(&au1550_ac97_mutex); |
1896 | return 0; | 1896 | return 0; |
1897 | } | 1897 | } |
1898 | 1898 | ||
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index 6ecd41abb066..87e2c72651f5 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -181,7 +181,7 @@ | |||
181 | #include <linux/init.h> | 181 | #include <linux/init.h> |
182 | #include <linux/soundcard.h> | 182 | #include <linux/soundcard.h> |
183 | #include <linux/poll.h> | 183 | #include <linux/poll.h> |
184 | #include <linux/smp_lock.h> | 184 | #include <linux/mutex.h> |
185 | 185 | ||
186 | #include <asm/uaccess.h> | 186 | #include <asm/uaccess.h> |
187 | 187 | ||
@@ -194,6 +194,7 @@ | |||
194 | * Declarations | 194 | * Declarations |
195 | */ | 195 | */ |
196 | 196 | ||
197 | static DEFINE_MUTEX(dmasound_core_mutex); | ||
197 | int dmasound_catchRadius = 0; | 198 | int dmasound_catchRadius = 0; |
198 | module_param(dmasound_catchRadius, int, 0); | 199 | module_param(dmasound_catchRadius, int, 0); |
199 | 200 | ||
@@ -323,22 +324,22 @@ static struct { | |||
323 | 324 | ||
324 | static int mixer_open(struct inode *inode, struct file *file) | 325 | static int mixer_open(struct inode *inode, struct file *file) |
325 | { | 326 | { |
326 | lock_kernel(); | 327 | mutex_lock(&dmasound_core_mutex); |
327 | if (!try_module_get(dmasound.mach.owner)) { | 328 | if (!try_module_get(dmasound.mach.owner)) { |
328 | unlock_kernel(); | 329 | mutex_unlock(&dmasound_core_mutex); |
329 | return -ENODEV; | 330 | return -ENODEV; |
330 | } | 331 | } |
331 | mixer.busy = 1; | 332 | mixer.busy = 1; |
332 | unlock_kernel(); | 333 | mutex_unlock(&dmasound_core_mutex); |
333 | return 0; | 334 | return 0; |
334 | } | 335 | } |
335 | 336 | ||
336 | static int mixer_release(struct inode *inode, struct file *file) | 337 | static int mixer_release(struct inode *inode, struct file *file) |
337 | { | 338 | { |
338 | lock_kernel(); | 339 | mutex_lock(&dmasound_core_mutex); |
339 | mixer.busy = 0; | 340 | mixer.busy = 0; |
340 | module_put(dmasound.mach.owner); | 341 | module_put(dmasound.mach.owner); |
341 | unlock_kernel(); | 342 | mutex_unlock(&dmasound_core_mutex); |
342 | return 0; | 343 | return 0; |
343 | } | 344 | } |
344 | 345 | ||
@@ -370,9 +371,9 @@ static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
370 | { | 371 | { |
371 | int ret; | 372 | int ret; |
372 | 373 | ||
373 | lock_kernel(); | 374 | mutex_lock(&dmasound_core_mutex); |
374 | ret = mixer_ioctl(file, cmd, arg); | 375 | ret = mixer_ioctl(file, cmd, arg); |
375 | unlock_kernel(); | 376 | mutex_unlock(&dmasound_core_mutex); |
376 | 377 | ||
377 | return ret; | 378 | return ret; |
378 | } | 379 | } |
@@ -752,9 +753,9 @@ static int sq_open(struct inode *inode, struct file *file) | |||
752 | { | 753 | { |
753 | int rc; | 754 | int rc; |
754 | 755 | ||
755 | lock_kernel(); | 756 | mutex_lock(&dmasound_core_mutex); |
756 | if (!try_module_get(dmasound.mach.owner)) { | 757 | if (!try_module_get(dmasound.mach.owner)) { |
757 | unlock_kernel(); | 758 | mutex_unlock(&dmasound_core_mutex); |
758 | return -ENODEV; | 759 | return -ENODEV; |
759 | } | 760 | } |
760 | 761 | ||
@@ -799,11 +800,11 @@ static int sq_open(struct inode *inode, struct file *file) | |||
799 | sound_set_format(AFMT_MU_LAW); | 800 | sound_set_format(AFMT_MU_LAW); |
800 | } | 801 | } |
801 | #endif | 802 | #endif |
802 | unlock_kernel(); | 803 | mutex_unlock(&dmasound_core_mutex); |
803 | return 0; | 804 | return 0; |
804 | out: | 805 | out: |
805 | module_put(dmasound.mach.owner); | 806 | module_put(dmasound.mach.owner); |
806 | unlock_kernel(); | 807 | mutex_unlock(&dmasound_core_mutex); |
807 | return rc; | 808 | return rc; |
808 | } | 809 | } |
809 | 810 | ||
@@ -869,7 +870,7 @@ static int sq_release(struct inode *inode, struct file *file) | |||
869 | { | 870 | { |
870 | int rc = 0; | 871 | int rc = 0; |
871 | 872 | ||
872 | lock_kernel(); | 873 | mutex_lock(&dmasound_core_mutex); |
873 | 874 | ||
874 | if (file->f_mode & FMODE_WRITE) { | 875 | if (file->f_mode & FMODE_WRITE) { |
875 | if (write_sq.busy) | 876 | if (write_sq.busy) |
@@ -900,7 +901,7 @@ static int sq_release(struct inode *inode, struct file *file) | |||
900 | write_sq_wake_up(file); /* checks f_mode */ | 901 | write_sq_wake_up(file); /* checks f_mode */ |
901 | #endif /* blocking open() */ | 902 | #endif /* blocking open() */ |
902 | 903 | ||
903 | unlock_kernel(); | 904 | mutex_unlock(&dmasound_core_mutex); |
904 | 905 | ||
905 | return rc; | 906 | return rc; |
906 | } | 907 | } |
@@ -1141,9 +1142,9 @@ static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
1141 | { | 1142 | { |
1142 | int ret; | 1143 | int ret; |
1143 | 1144 | ||
1144 | lock_kernel(); | 1145 | mutex_lock(&dmasound_core_mutex); |
1145 | ret = sq_ioctl(file, cmd, arg); | 1146 | ret = sq_ioctl(file, cmd, arg); |
1146 | unlock_kernel(); | 1147 | mutex_unlock(&dmasound_core_mutex); |
1147 | 1148 | ||
1148 | return ret; | 1149 | return ret; |
1149 | } | 1150 | } |
@@ -1257,7 +1258,7 @@ static int state_open(struct inode *inode, struct file *file) | |||
1257 | int len = 0; | 1258 | int len = 0; |
1258 | int ret; | 1259 | int ret; |
1259 | 1260 | ||
1260 | lock_kernel(); | 1261 | mutex_lock(&dmasound_core_mutex); |
1261 | ret = -EBUSY; | 1262 | ret = -EBUSY; |
1262 | if (state.busy) | 1263 | if (state.busy) |
1263 | goto out; | 1264 | goto out; |
@@ -1329,16 +1330,16 @@ printk("dmasound: stat buffer used %d bytes\n", len) ; | |||
1329 | state.len = len; | 1330 | state.len = len; |
1330 | ret = 0; | 1331 | ret = 0; |
1331 | out: | 1332 | out: |
1332 | unlock_kernel(); | 1333 | mutex_unlock(&dmasound_core_mutex); |
1333 | return ret; | 1334 | return ret; |
1334 | } | 1335 | } |
1335 | 1336 | ||
1336 | static int state_release(struct inode *inode, struct file *file) | 1337 | static int state_release(struct inode *inode, struct file *file) |
1337 | { | 1338 | { |
1338 | lock_kernel(); | 1339 | mutex_lock(&dmasound_core_mutex); |
1339 | state.busy = 0; | 1340 | state.busy = 0; |
1340 | module_put(dmasound.mach.owner); | 1341 | module_put(dmasound.mach.owner); |
1341 | unlock_kernel(); | 1342 | mutex_unlock(&dmasound_core_mutex); |
1342 | return 0; | 1343 | return 0; |
1343 | } | 1344 | } |
1344 | 1345 | ||
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c index 2e48b17667d0..b4c1eb504c22 100644 --- a/sound/oss/msnd_pinnacle.c +++ b/sound/oss/msnd_pinnacle.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/init.h> | 40 | #include <linux/init.h> |
41 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
42 | #include <linux/smp_lock.h> | 42 | #include <linux/mutex.h> |
43 | #include <linux/gfp.h> | 43 | #include <linux/gfp.h> |
44 | #include <asm/irq.h> | 44 | #include <asm/irq.h> |
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
@@ -79,6 +79,7 @@ | |||
79 | dev.rec_sample_rate / \ | 79 | dev.rec_sample_rate / \ |
80 | dev.rec_channels) | 80 | dev.rec_channels) |
81 | 81 | ||
82 | static DEFINE_MUTEX(msnd_pinnacle_mutex); | ||
82 | static multisound_dev_t dev; | 83 | static multisound_dev_t dev; |
83 | 84 | ||
84 | #ifndef HAVE_DSPCODEH | 85 | #ifndef HAVE_DSPCODEH |
@@ -651,12 +652,12 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
651 | 652 | ||
652 | ret = -EINVAL; | 653 | ret = -EINVAL; |
653 | 654 | ||
654 | lock_kernel(); | 655 | mutex_lock(&msnd_pinnacle_mutex); |
655 | if (minor == dev.dsp_minor) | 656 | if (minor == dev.dsp_minor) |
656 | ret = dsp_ioctl(file, cmd, arg); | 657 | ret = dsp_ioctl(file, cmd, arg); |
657 | else if (minor == dev.mixer_minor) | 658 | else if (minor == dev.mixer_minor) |
658 | ret = mixer_ioctl(cmd, arg); | 659 | ret = mixer_ioctl(cmd, arg); |
659 | unlock_kernel(); | 660 | mutex_unlock(&msnd_pinnacle_mutex); |
660 | 661 | ||
661 | return ret; | 662 | return ret; |
662 | } | 663 | } |
@@ -761,7 +762,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
761 | int minor = iminor(inode); | 762 | int minor = iminor(inode); |
762 | int err = 0; | 763 | int err = 0; |
763 | 764 | ||
764 | lock_kernel(); | 765 | mutex_lock(&msnd_pinnacle_mutex); |
765 | if (minor == dev.dsp_minor) { | 766 | if (minor == dev.dsp_minor) { |
766 | if ((file->f_mode & FMODE_WRITE && | 767 | if ((file->f_mode & FMODE_WRITE && |
767 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || | 768 | test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || |
@@ -791,7 +792,7 @@ static int dev_open(struct inode *inode, struct file *file) | |||
791 | } else | 792 | } else |
792 | err = -EINVAL; | 793 | err = -EINVAL; |
793 | out: | 794 | out: |
794 | unlock_kernel(); | 795 | mutex_unlock(&msnd_pinnacle_mutex); |
795 | return err; | 796 | return err; |
796 | } | 797 | } |
797 | 798 | ||
@@ -800,14 +801,14 @@ static int dev_release(struct inode *inode, struct file *file) | |||
800 | int minor = iminor(inode); | 801 | int minor = iminor(inode); |
801 | int err = 0; | 802 | int err = 0; |
802 | 803 | ||
803 | lock_kernel(); | 804 | mutex_lock(&msnd_pinnacle_mutex); |
804 | if (minor == dev.dsp_minor) | 805 | if (minor == dev.dsp_minor) |
805 | err = dsp_release(file); | 806 | err = dsp_release(file); |
806 | else if (minor == dev.mixer_minor) { | 807 | else if (minor == dev.mixer_minor) { |
807 | /* nothing */ | 808 | /* nothing */ |
808 | } else | 809 | } else |
809 | err = -EINVAL; | 810 | err = -EINVAL; |
810 | unlock_kernel(); | 811 | mutex_unlock(&msnd_pinnacle_mutex); |
811 | return err; | 812 | return err; |
812 | } | 813 | } |
813 | 814 | ||
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c index 479e3025a8a3..53bba16bf709 100644 --- a/sound/oss/sh_dac_audio.c +++ b/sound/oss/sh_dac_audio.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/sound.h> | 18 | #include <linux/sound.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/mutex.h> |
20 | #include <linux/soundcard.h> | 20 | #include <linux/soundcard.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/hrtimer.h> | 22 | #include <linux/hrtimer.h> |
@@ -34,6 +34,7 @@ | |||
34 | 34 | ||
35 | #define BUFFER_SIZE 48000 | 35 | #define BUFFER_SIZE 48000 |
36 | 36 | ||
37 | static DEFINE_MUTEX(sh_dac_audio_mutex); | ||
37 | static int rate; | 38 | static int rate; |
38 | static int empty; | 39 | static int empty; |
39 | static char *data_buffer, *buffer_begin, *buffer_end; | 40 | static char *data_buffer, *buffer_begin, *buffer_end; |
@@ -163,9 +164,9 @@ static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
163 | { | 164 | { |
164 | int ret; | 165 | int ret; |
165 | 166 | ||
166 | lock_kernel(); | 167 | mutex_lock(&sh_dac_audio_mutex); |
167 | ret = dac_audio_ioctl(file, cmd, arg); | 168 | ret = dac_audio_ioctl(file, cmd, arg); |
168 | unlock_kernel(); | 169 | mutex_unlock(&sh_dac_audio_mutex); |
169 | 170 | ||
170 | return ret; | 171 | return ret; |
171 | } | 172 | } |
@@ -229,16 +230,16 @@ static int dac_audio_open(struct inode *inode, struct file *file) | |||
229 | if (file->f_mode & FMODE_READ) | 230 | if (file->f_mode & FMODE_READ) |
230 | return -ENODEV; | 231 | return -ENODEV; |
231 | 232 | ||
232 | lock_kernel(); | 233 | mutex_lock(&sh_dac_audio_mutex); |
233 | if (in_use) { | 234 | if (in_use) { |
234 | unlock_kernel(); | 235 | mutex_unlock(&sh_dac_audio_mutex); |
235 | return -EBUSY; | 236 | return -EBUSY; |
236 | } | 237 | } |
237 | 238 | ||
238 | in_use = 1; | 239 | in_use = 1; |
239 | 240 | ||
240 | dac_audio_start(); | 241 | dac_audio_start(); |
241 | unlock_kernel(); | 242 | mutex_unlock(&sh_dac_audio_mutex); |
242 | return 0; | 243 | return 0; |
243 | } | 244 | } |
244 | 245 | ||
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index 92aa762ffb7e..938ed94f904f 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <linux/major.h> | 40 | #include <linux/major.h> |
41 | #include <linux/delay.h> | 41 | #include <linux/delay.h> |
42 | #include <linux/proc_fs.h> | 42 | #include <linux/proc_fs.h> |
43 | #include <linux/smp_lock.h> | 43 | #include <linux/mutex.h> |
44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
45 | #include <linux/mm.h> | 45 | #include <linux/mm.h> |
46 | #include <linux/device.h> | 46 | #include <linux/device.h> |
@@ -56,6 +56,7 @@ | |||
56 | * Table for permanently allocated memory (used when unloading the module) | 56 | * Table for permanently allocated memory (used when unloading the module) |
57 | */ | 57 | */ |
58 | void * sound_mem_blocks[MAX_MEM_BLOCKS]; | 58 | void * sound_mem_blocks[MAX_MEM_BLOCKS]; |
59 | static DEFINE_MUTEX(soundcard_mutex); | ||
59 | int sound_nblocks = 0; | 60 | int sound_nblocks = 0; |
60 | 61 | ||
61 | /* Persistent DMA buffers */ | 62 | /* Persistent DMA buffers */ |
@@ -151,7 +152,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof | |||
151 | * big one anyway, we might as well bandage here.. | 152 | * big one anyway, we might as well bandage here.. |
152 | */ | 153 | */ |
153 | 154 | ||
154 | lock_kernel(); | 155 | mutex_lock(&soundcard_mutex); |
155 | 156 | ||
156 | DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); | 157 | DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); |
157 | switch (dev & 0x0f) { | 158 | switch (dev & 0x0f) { |
@@ -169,7 +170,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof | |||
169 | case SND_DEV_MIDIN: | 170 | case SND_DEV_MIDIN: |
170 | ret = MIDIbuf_read(dev, file, buf, count); | 171 | ret = MIDIbuf_read(dev, file, buf, count); |
171 | } | 172 | } |
172 | unlock_kernel(); | 173 | mutex_unlock(&soundcard_mutex); |
173 | return ret; | 174 | return ret; |
174 | } | 175 | } |
175 | 176 | ||
@@ -178,7 +179,7 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou | |||
178 | int dev = iminor(file->f_path.dentry->d_inode); | 179 | int dev = iminor(file->f_path.dentry->d_inode); |
179 | int ret = -EINVAL; | 180 | int ret = -EINVAL; |
180 | 181 | ||
181 | lock_kernel(); | 182 | mutex_lock(&soundcard_mutex); |
182 | DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); | 183 | DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); |
183 | switch (dev & 0x0f) { | 184 | switch (dev & 0x0f) { |
184 | case SND_DEV_SEQ: | 185 | case SND_DEV_SEQ: |
@@ -196,7 +197,7 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou | |||
196 | ret = MIDIbuf_write(dev, file, buf, count); | 197 | ret = MIDIbuf_write(dev, file, buf, count); |
197 | break; | 198 | break; |
198 | } | 199 | } |
199 | unlock_kernel(); | 200 | mutex_unlock(&soundcard_mutex); |
200 | return ret; | 201 | return ret; |
201 | } | 202 | } |
202 | 203 | ||
@@ -210,7 +211,7 @@ static int sound_open(struct inode *inode, struct file *file) | |||
210 | printk(KERN_ERR "Invalid minor device %d\n", dev); | 211 | printk(KERN_ERR "Invalid minor device %d\n", dev); |
211 | return -ENXIO; | 212 | return -ENXIO; |
212 | } | 213 | } |
213 | lock_kernel(); | 214 | mutex_lock(&soundcard_mutex); |
214 | switch (dev & 0x0f) { | 215 | switch (dev & 0x0f) { |
215 | case SND_DEV_CTL: | 216 | case SND_DEV_CTL: |
216 | dev >>= 4; | 217 | dev >>= 4; |
@@ -247,7 +248,7 @@ static int sound_open(struct inode *inode, struct file *file) | |||
247 | retval = -ENXIO; | 248 | retval = -ENXIO; |
248 | } | 249 | } |
249 | 250 | ||
250 | unlock_kernel(); | 251 | mutex_unlock(&soundcard_mutex); |
251 | return 0; | 252 | return 0; |
252 | } | 253 | } |
253 | 254 | ||
@@ -255,7 +256,7 @@ static int sound_release(struct inode *inode, struct file *file) | |||
255 | { | 256 | { |
256 | int dev = iminor(inode); | 257 | int dev = iminor(inode); |
257 | 258 | ||
258 | lock_kernel(); | 259 | mutex_lock(&soundcard_mutex); |
259 | DEB(printk("sound_release(dev=%d)\n", dev)); | 260 | DEB(printk("sound_release(dev=%d)\n", dev)); |
260 | switch (dev & 0x0f) { | 261 | switch (dev & 0x0f) { |
261 | case SND_DEV_CTL: | 262 | case SND_DEV_CTL: |
@@ -280,7 +281,7 @@ static int sound_release(struct inode *inode, struct file *file) | |||
280 | default: | 281 | default: |
281 | printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); | 282 | printk(KERN_ERR "Sound error: Releasing unknown device 0x%02x\n", dev); |
282 | } | 283 | } |
283 | unlock_kernel(); | 284 | mutex_unlock(&soundcard_mutex); |
284 | 285 | ||
285 | return 0; | 286 | return 0; |
286 | } | 287 | } |
@@ -354,7 +355,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
354 | if (cmd == OSS_GETVERSION) | 355 | if (cmd == OSS_GETVERSION) |
355 | return __put_user(SOUND_VERSION, (int __user *)p); | 356 | return __put_user(SOUND_VERSION, (int __user *)p); |
356 | 357 | ||
357 | lock_kernel(); | 358 | mutex_lock(&soundcard_mutex); |
358 | if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ | 359 | if (_IOC_TYPE(cmd) == 'M' && num_mixers > 0 && /* Mixer ioctl */ |
359 | (dev & 0x0f) != SND_DEV_CTL) { | 360 | (dev & 0x0f) != SND_DEV_CTL) { |
360 | dtype = dev & 0x0f; | 361 | dtype = dev & 0x0f; |
@@ -369,7 +370,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
369 | ret = sound_mixer_ioctl(dev >> 4, cmd, p); | 370 | ret = sound_mixer_ioctl(dev >> 4, cmd, p); |
370 | break; | 371 | break; |
371 | } | 372 | } |
372 | unlock_kernel(); | 373 | mutex_unlock(&soundcard_mutex); |
373 | return ret; | 374 | return ret; |
374 | } | 375 | } |
375 | 376 | ||
@@ -399,7 +400,7 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
399 | break; | 400 | break; |
400 | 401 | ||
401 | } | 402 | } |
402 | unlock_kernel(); | 403 | mutex_unlock(&soundcard_mutex); |
403 | return ret; | 404 | return ret; |
404 | } | 405 | } |
405 | 406 | ||
@@ -439,35 +440,35 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
439 | printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n"); | 440 | printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n"); |
440 | return -EINVAL; | 441 | return -EINVAL; |
441 | } | 442 | } |
442 | lock_kernel(); | 443 | mutex_lock(&soundcard_mutex); |
443 | if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */ | 444 | if (vma->vm_flags & VM_WRITE) /* Map write and read/write to the output buf */ |
444 | dmap = audio_devs[dev]->dmap_out; | 445 | dmap = audio_devs[dev]->dmap_out; |
445 | else if (vma->vm_flags & VM_READ) | 446 | else if (vma->vm_flags & VM_READ) |
446 | dmap = audio_devs[dev]->dmap_in; | 447 | dmap = audio_devs[dev]->dmap_in; |
447 | else { | 448 | else { |
448 | printk(KERN_ERR "Sound: Undefined mmap() access\n"); | 449 | printk(KERN_ERR "Sound: Undefined mmap() access\n"); |
449 | unlock_kernel(); | 450 | mutex_unlock(&soundcard_mutex); |
450 | return -EINVAL; | 451 | return -EINVAL; |
451 | } | 452 | } |
452 | 453 | ||
453 | if (dmap == NULL) { | 454 | if (dmap == NULL) { |
454 | printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n"); | 455 | printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n"); |
455 | unlock_kernel(); | 456 | mutex_unlock(&soundcard_mutex); |
456 | return -EIO; | 457 | return -EIO; |
457 | } | 458 | } |
458 | if (dmap->raw_buf == NULL) { | 459 | if (dmap->raw_buf == NULL) { |
459 | printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n"); | 460 | printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n"); |
460 | unlock_kernel(); | 461 | mutex_unlock(&soundcard_mutex); |
461 | return -EIO; | 462 | return -EIO; |
462 | } | 463 | } |
463 | if (dmap->mapping_flags) { | 464 | if (dmap->mapping_flags) { |
464 | printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n"); | 465 | printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n"); |
465 | unlock_kernel(); | 466 | mutex_unlock(&soundcard_mutex); |
466 | return -EIO; | 467 | return -EIO; |
467 | } | 468 | } |
468 | if (vma->vm_pgoff != 0) { | 469 | if (vma->vm_pgoff != 0) { |
469 | printk(KERN_ERR "Sound: mmap() offset must be 0.\n"); | 470 | printk(KERN_ERR "Sound: mmap() offset must be 0.\n"); |
470 | unlock_kernel(); | 471 | mutex_unlock(&soundcard_mutex); |
471 | return -EINVAL; | 472 | return -EINVAL; |
472 | } | 473 | } |
473 | size = vma->vm_end - vma->vm_start; | 474 | size = vma->vm_end - vma->vm_start; |
@@ -478,7 +479,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
478 | if (remap_pfn_range(vma, vma->vm_start, | 479 | if (remap_pfn_range(vma, vma->vm_start, |
479 | virt_to_phys(dmap->raw_buf) >> PAGE_SHIFT, | 480 | virt_to_phys(dmap->raw_buf) >> PAGE_SHIFT, |
480 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) { | 481 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) { |
481 | unlock_kernel(); | 482 | mutex_unlock(&soundcard_mutex); |
482 | return -EAGAIN; | 483 | return -EAGAIN; |
483 | } | 484 | } |
484 | 485 | ||
@@ -490,7 +491,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma) | |||
490 | memset(dmap->raw_buf, | 491 | memset(dmap->raw_buf, |
491 | dmap->neutral_byte, | 492 | dmap->neutral_byte, |
492 | dmap->bytes_in_use); | 493 | dmap->bytes_in_use); |
493 | unlock_kernel(); | 494 | mutex_unlock(&soundcard_mutex); |
494 | return 0; | 495 | return 0; |
495 | } | 496 | } |
496 | 497 | ||
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index b15840ad2527..44357d877a27 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -68,7 +68,6 @@ | |||
68 | #include <linux/delay.h> | 68 | #include <linux/delay.h> |
69 | #include <linux/sound.h> | 69 | #include <linux/sound.h> |
70 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
71 | #include <linux/smp_lock.h> | ||
72 | #include <linux/soundcard.h> | 71 | #include <linux/soundcard.h> |
73 | #include <linux/ac97_codec.h> | 72 | #include <linux/ac97_codec.h> |
74 | #include <linux/pci.h> | 73 | #include <linux/pci.h> |
@@ -94,6 +93,7 @@ | |||
94 | 93 | ||
95 | struct cs4297a_state; | 94 | struct cs4297a_state; |
96 | 95 | ||
96 | static DEFINE_MUTEX(swarm_cs4297a_mutex); | ||
97 | static void stop_dac(struct cs4297a_state *s); | 97 | static void stop_dac(struct cs4297a_state *s); |
98 | static void stop_adc(struct cs4297a_state *s); | 98 | static void stop_adc(struct cs4297a_state *s); |
99 | static void start_dac(struct cs4297a_state *s); | 99 | static void start_dac(struct cs4297a_state *s); |
@@ -1535,7 +1535,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1535 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1535 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1536 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); | 1536 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); |
1537 | 1537 | ||
1538 | lock_kernel(); | 1538 | mutex_lock(&swarm_cs4297a_mutex); |
1539 | list_for_each(entry, &cs4297a_devs) | 1539 | list_for_each(entry, &cs4297a_devs) |
1540 | { | 1540 | { |
1541 | s = list_entry(entry, struct cs4297a_state, list); | 1541 | s = list_entry(entry, struct cs4297a_state, list); |
@@ -1547,7 +1547,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1547 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, | 1547 | CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, |
1548 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); | 1548 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); |
1549 | 1549 | ||
1550 | unlock_kernel(); | 1550 | mutex_unlock(&swarm_cs4297a_mutex); |
1551 | return -ENODEV; | 1551 | return -ENODEV; |
1552 | } | 1552 | } |
1553 | VALIDATE_STATE(s); | 1553 | VALIDATE_STATE(s); |
@@ -1555,7 +1555,7 @@ static int cs4297a_open_mixdev(struct inode *inode, struct file *file) | |||
1555 | 1555 | ||
1556 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, | 1556 | CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, |
1557 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); | 1557 | printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); |
1558 | unlock_kernel(); | 1558 | mutex_unlock(&swarm_cs4297a_mutex); |
1559 | 1559 | ||
1560 | return nonseekable_open(inode, file); | 1560 | return nonseekable_open(inode, file); |
1561 | } | 1561 | } |
@@ -1575,10 +1575,10 @@ static int cs4297a_ioctl_mixdev(struct file *file, | |||
1575 | unsigned int cmd, unsigned long arg) | 1575 | unsigned int cmd, unsigned long arg) |
1576 | { | 1576 | { |
1577 | int ret; | 1577 | int ret; |
1578 | lock_kernel(); | 1578 | mutex_lock(&swarm_cs4297a_mutex); |
1579 | ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, | 1579 | ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, |
1580 | arg); | 1580 | arg); |
1581 | unlock_kernel(); | 1581 | mutex_unlock(&swarm_cs4297a_mutex); |
1582 | return ret; | 1582 | return ret; |
1583 | } | 1583 | } |
1584 | 1584 | ||
@@ -2350,9 +2350,9 @@ static long cs4297a_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | |||
2350 | { | 2350 | { |
2351 | int ret; | 2351 | int ret; |
2352 | 2352 | ||
2353 | lock_kernel(); | 2353 | mutex_lock(&swarm_cs4297a_mutex); |
2354 | ret = cs4297a_ioctl(file, cmd, arg); | 2354 | ret = cs4297a_ioctl(file, cmd, arg); |
2355 | unlock_kernel(); | 2355 | mutex_unlock(&swarm_cs4297a_mutex); |
2356 | 2356 | ||
2357 | return ret; | 2357 | return ret; |
2358 | } | 2358 | } |
@@ -2509,9 +2509,9 @@ static int cs4297a_open(struct inode *inode, struct file *file) | |||
2509 | { | 2509 | { |
2510 | int ret; | 2510 | int ret; |
2511 | 2511 | ||
2512 | lock_kernel(); | 2512 | mutex_lock(&swarm_cs4297a_mutex); |
2513 | ret = cs4297a_open(inode, file); | 2513 | ret = cs4297a_open(inode, file); |
2514 | unlock_kernel(); | 2514 | mutex_unlock(&swarm_cs4297a_mutex); |
2515 | 2515 | ||
2516 | return ret; | 2516 | return ret; |
2517 | } | 2517 | } |
diff --git a/sound/oss/vwsnd.c b/sound/oss/vwsnd.c index 8cd73cdd88af..643f1113b1d8 100644 --- a/sound/oss/vwsnd.c +++ b/sound/oss/vwsnd.c | |||
@@ -145,7 +145,6 @@ | |||
145 | #include <linux/init.h> | 145 | #include <linux/init.h> |
146 | 146 | ||
147 | #include <linux/spinlock.h> | 147 | #include <linux/spinlock.h> |
148 | #include <linux/smp_lock.h> | ||
149 | #include <linux/wait.h> | 148 | #include <linux/wait.h> |
150 | #include <linux/interrupt.h> | 149 | #include <linux/interrupt.h> |
151 | #include <linux/mutex.h> | 150 | #include <linux/mutex.h> |
@@ -160,6 +159,7 @@ | |||
160 | 159 | ||
161 | #ifdef VWSND_DEBUG | 160 | #ifdef VWSND_DEBUG |
162 | 161 | ||
162 | static DEFINE_MUTEX(vwsnd_mutex); | ||
163 | static int shut_up = 1; | 163 | static int shut_up = 1; |
164 | 164 | ||
165 | /* | 165 | /* |
@@ -2891,11 +2891,11 @@ static long vwsnd_audio_ioctl(struct file *file, | |||
2891 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; | 2891 | vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; |
2892 | int ret; | 2892 | int ret; |
2893 | 2893 | ||
2894 | lock_kernel(); | 2894 | mutex_lock(&vwsnd_mutex); |
2895 | mutex_lock(&devc->io_mutex); | 2895 | mutex_lock(&devc->io_mutex); |
2896 | ret = vwsnd_audio_do_ioctl(file, cmd, arg); | 2896 | ret = vwsnd_audio_do_ioctl(file, cmd, arg); |
2897 | mutex_unlock(&devc->io_mutex); | 2897 | mutex_unlock(&devc->io_mutex); |
2898 | unlock_kernel(); | 2898 | mutex_unlock(&vwsnd_mutex); |
2899 | 2899 | ||
2900 | return ret; | 2900 | return ret; |
2901 | } | 2901 | } |
@@ -2922,7 +2922,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2922 | 2922 | ||
2923 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); | 2923 | DBGE("(inode=0x%p, file=0x%p)\n", inode, file); |
2924 | 2924 | ||
2925 | lock_kernel(); | 2925 | mutex_lock(&vwsnd_mutex); |
2926 | INC_USE_COUNT; | 2926 | INC_USE_COUNT; |
2927 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 2927 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
2928 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) | 2928 | if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) |
@@ -2930,7 +2930,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2930 | 2930 | ||
2931 | if (devc == NULL) { | 2931 | if (devc == NULL) { |
2932 | DEC_USE_COUNT; | 2932 | DEC_USE_COUNT; |
2933 | unlock_kernel(); | 2933 | mutex_unlock(&vwsnd_mutex); |
2934 | return -ENODEV; | 2934 | return -ENODEV; |
2935 | } | 2935 | } |
2936 | 2936 | ||
@@ -2939,13 +2939,13 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2939 | mutex_unlock(&devc->open_mutex); | 2939 | mutex_unlock(&devc->open_mutex); |
2940 | if (file->f_flags & O_NONBLOCK) { | 2940 | if (file->f_flags & O_NONBLOCK) { |
2941 | DEC_USE_COUNT; | 2941 | DEC_USE_COUNT; |
2942 | unlock_kernel(); | 2942 | mutex_unlock(&vwsnd_mutex); |
2943 | return -EBUSY; | 2943 | return -EBUSY; |
2944 | } | 2944 | } |
2945 | interruptible_sleep_on(&devc->open_wait); | 2945 | interruptible_sleep_on(&devc->open_wait); |
2946 | if (signal_pending(current)) { | 2946 | if (signal_pending(current)) { |
2947 | DEC_USE_COUNT; | 2947 | DEC_USE_COUNT; |
2948 | unlock_kernel(); | 2948 | mutex_unlock(&vwsnd_mutex); |
2949 | return -ERESTARTSYS; | 2949 | return -ERESTARTSYS; |
2950 | } | 2950 | } |
2951 | mutex_lock(&devc->open_mutex); | 2951 | mutex_lock(&devc->open_mutex); |
@@ -2998,7 +2998,7 @@ static int vwsnd_audio_open(struct inode *inode, struct file *file) | |||
2998 | 2998 | ||
2999 | file->private_data = devc; | 2999 | file->private_data = devc; |
3000 | DBGRV(); | 3000 | DBGRV(); |
3001 | unlock_kernel(); | 3001 | mutex_unlock(&vwsnd_mutex); |
3002 | return 0; | 3002 | return 0; |
3003 | } | 3003 | } |
3004 | 3004 | ||
@@ -3012,7 +3012,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file) | |||
3012 | vwsnd_port_t *wport = NULL, *rport = NULL; | 3012 | vwsnd_port_t *wport = NULL, *rport = NULL; |
3013 | int err = 0; | 3013 | int err = 0; |
3014 | 3014 | ||
3015 | lock_kernel(); | 3015 | mutex_lock(&vwsnd_mutex); |
3016 | mutex_lock(&devc->io_mutex); | 3016 | mutex_lock(&devc->io_mutex); |
3017 | { | 3017 | { |
3018 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); | 3018 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); |
@@ -3040,7 +3040,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file) | |||
3040 | wake_up(&devc->open_wait); | 3040 | wake_up(&devc->open_wait); |
3041 | DEC_USE_COUNT; | 3041 | DEC_USE_COUNT; |
3042 | DBGR(); | 3042 | DBGR(); |
3043 | unlock_kernel(); | 3043 | mutex_unlock(&vwsnd_mutex); |
3044 | return err; | 3044 | return err; |
3045 | } | 3045 | } |
3046 | 3046 | ||
@@ -3068,18 +3068,18 @@ static int vwsnd_mixer_open(struct inode *inode, struct file *file) | |||
3068 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); | 3068 | DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); |
3069 | 3069 | ||
3070 | INC_USE_COUNT; | 3070 | INC_USE_COUNT; |
3071 | lock_kernel(); | 3071 | mutex_lock(&vwsnd_mutex); |
3072 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) | 3072 | for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) |
3073 | if (devc->mixer_minor == iminor(inode)) | 3073 | if (devc->mixer_minor == iminor(inode)) |
3074 | break; | 3074 | break; |
3075 | 3075 | ||
3076 | if (devc == NULL) { | 3076 | if (devc == NULL) { |
3077 | DEC_USE_COUNT; | 3077 | DEC_USE_COUNT; |
3078 | unlock_kernel(); | 3078 | mutex_unlock(&vwsnd_mutex); |
3079 | return -ENODEV; | 3079 | return -ENODEV; |
3080 | } | 3080 | } |
3081 | file->private_data = devc; | 3081 | file->private_data = devc; |
3082 | unlock_kernel(); | 3082 | mutex_unlock(&vwsnd_mutex); |
3083 | return 0; | 3083 | return 0; |
3084 | } | 3084 | } |
3085 | 3085 | ||
@@ -3223,7 +3223,7 @@ static long vwsnd_mixer_ioctl(struct file *file, | |||
3223 | 3223 | ||
3224 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); | 3224 | DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); |
3225 | 3225 | ||
3226 | lock_kernel(); | 3226 | mutex_lock(&vwsnd_mutex); |
3227 | mutex_lock(&devc->mix_mutex); | 3227 | mutex_lock(&devc->mix_mutex); |
3228 | { | 3228 | { |
3229 | if ((cmd & ~nrmask) == MIXER_READ(0)) | 3229 | if ((cmd & ~nrmask) == MIXER_READ(0)) |
@@ -3234,7 +3234,7 @@ static long vwsnd_mixer_ioctl(struct file *file, | |||
3234 | retval = -EINVAL; | 3234 | retval = -EINVAL; |
3235 | } | 3235 | } |
3236 | mutex_unlock(&devc->mix_mutex); | 3236 | mutex_unlock(&devc->mix_mutex); |
3237 | unlock_kernel(); | 3237 | mutex_unlock(&vwsnd_mutex); |
3238 | return retval; | 3238 | return retval; |
3239 | } | 3239 | } |
3240 | 3240 | ||