diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-07-30 13:15:24 -0400 |
---|---|---|
committer | Jesper Nilsson <jesper.nilsson@axis.com> | 2010-08-04 06:59:06 -0400 |
commit | 096b7bdc8663c16417ff5fbec42622302e6886e1 (patch) | |
tree | bbd80f3cf2ac7fe766f602b8d20d53dfd7759ec8 /arch/cris/arch-v10 | |
parent | 90276a1a64e2ab732e26e3ac68febbf3ad04c517 (diff) |
cris: 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.
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: Jesper Nilsson <jesper.nilsson@axis.com>
Diffstat (limited to 'arch/cris/arch-v10')
-rw-r--r-- | arch/cris/arch-v10/drivers/eeprom.c | 2 | ||||
-rw-r--r-- | arch/cris/arch-v10/drivers/i2c.c | 2 |
2 files changed, 0 insertions, 4 deletions
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c index c3405507a3d1..5047a33043bd 100644 --- a/arch/cris/arch-v10/drivers/eeprom.c +++ b/arch/cris/arch-v10/drivers/eeprom.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
33 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
34 | #include "i2c.h" | 33 | #include "i2c.h" |
@@ -376,7 +375,6 @@ int __init eeprom_init(void) | |||
376 | /* Opens the device. */ | 375 | /* Opens the device. */ |
377 | static int eeprom_open(struct inode * inode, struct file * file) | 376 | static int eeprom_open(struct inode * inode, struct file * file) |
378 | { | 377 | { |
379 | cycle_kernel_lock(); | ||
380 | if(iminor(inode) != EEPROM_MINOR_NR) | 378 | if(iminor(inode) != EEPROM_MINOR_NR) |
381 | return -ENXIO; | 379 | return -ENXIO; |
382 | if(imajor(inode) != EEPROM_MAJOR_NR) | 380 | if(imajor(inode) != EEPROM_MAJOR_NR) |
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c index 399e089bed7a..54e2e1adf085 100644 --- a/arch/cris/arch-v10/drivers/i2c.c +++ b/arch/cris/arch-v10/drivers/i2c.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/smp_lock.h> | ||
18 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
19 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
@@ -566,7 +565,6 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg) | |||
566 | static int | 565 | static int |
567 | i2c_open(struct inode *inode, struct file *filp) | 566 | i2c_open(struct inode *inode, struct file *filp) |
568 | { | 567 | { |
569 | cycle_kernel_lock(); | ||
570 | return 0; | 568 | return 0; |
571 | } | 569 | } |
572 | 570 | ||