aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/telephony/ixj.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-06-02 08:28:52 -0400
committerArnd Bergmann <arnd@arndb.de>2010-10-05 09:01:04 -0400
commit613655fa39ff6957754fa8ceb8559980920eb8ee (patch)
treead19600cb81207b24188683d7fc4ae88013339d1 /drivers/telephony/ixj.c
parent609146fdb319cebce93be550938ab852f7bade90 (diff)
drivers: autoconvert trivial BKL users to private mutex
All these files use the big kernel lock in a trivial way to serialize their private file operations, typically resulting from an earlier semi-automatic pushdown from VFS. None of these drivers appears to want to lock against other code, and they all use the BKL as the top-level lock in their file operations, meaning that there is no lock-order inversion problem. Consequently, we can remove the BKL completely, replacing it with a per-file mutex in every case. Using a scripted approach means we can avoid typos. These drivers do not seem to be under active maintainance from my brief investigation. Apologies to those maintainers that I have missed. 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>
Diffstat (limited to 'drivers/telephony/ixj.c')
-rw-r--r--drivers/telephony/ixj.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index b53deee25d74..b1e469983b1d 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -257,7 +257,7 @@
257#include <linux/fs.h> /* everything... */ 257#include <linux/fs.h> /* everything... */
258#include <linux/errno.h> /* error codes */ 258#include <linux/errno.h> /* error codes */
259#include <linux/slab.h> 259#include <linux/slab.h>
260#include <linux/smp_lock.h> 260#include <linux/mutex.h>
261#include <linux/mm.h> 261#include <linux/mm.h>
262#include <linux/ioport.h> 262#include <linux/ioport.h>
263#include <linux/interrupt.h> 263#include <linux/interrupt.h>
@@ -277,6 +277,7 @@
277#define TYPE(inode) (iminor(inode) >> 4) 277#define TYPE(inode) (iminor(inode) >> 4)
278#define NUM(inode) (iminor(inode) & 0xf) 278#define NUM(inode) (iminor(inode) & 0xf)
279 279
280static DEFINE_MUTEX(ixj_mutex);
280static int ixjdebug; 281static int ixjdebug;
281static int hertz = HZ; 282static int hertz = HZ;
282static int samplerate = 100; 283static int samplerate = 100;
@@ -6655,9 +6656,9 @@ static long do_ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long ar
6655static long ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg) 6656static long ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg)
6656{ 6657{
6657 long ret; 6658 long ret;
6658 lock_kernel(); 6659 mutex_lock(&ixj_mutex);
6659 ret = do_ixj_ioctl(file_p, cmd, arg); 6660 ret = do_ixj_ioctl(file_p, cmd, arg);
6660 unlock_kernel(); 6661 mutex_unlock(&ixj_mutex);
6661 return ret; 6662 return ret;
6662} 6663}
6663 6664