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/oss/au1550_ac97.c | |
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/oss/au1550_ac97.c')
-rw-r--r-- | sound/oss/au1550_ac97.c | 30 |
1 files changed, 15 insertions, 15 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 | ||