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/swarm_cs4297a.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/swarm_cs4297a.c')
-rw-r--r-- | sound/oss/swarm_cs4297a.c | 20 |
1 files changed, 10 insertions, 10 deletions
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 | } |