aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.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:10 -0400
commit2a48fc0ab24241755dc93bfd4f01d68efab47f5a (patch)
treefa9ae10ce89b26b7d8ae9ce24bdfda5e3007b763 /drivers/block/cciss.c
parent613655fa39ff6957754fa8ceb8559980920eb8ee (diff)
block: autoconvert trivial BKL users to private mutex
The block device drivers have all gained new lock_kernel calls from a recent pushdown, and some of the drivers were already using the BKL before. This turns the BKL into a set of per-driver mutexes. Still need to check whether this is safe to do. 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/block/cciss.c')
-rw-r--r--drivers/block/cciss.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 6124c2fd2d3..ba9c3a4947c 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -26,7 +26,6 @@
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/smp_lock.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/major.h> 30#include <linux/major.h>
32#include <linux/fs.h> 31#include <linux/fs.h>
@@ -66,6 +65,7 @@ MODULE_SUPPORTED_DEVICE("HP Smart Array Controllers");
66MODULE_VERSION("3.6.26"); 65MODULE_VERSION("3.6.26");
67MODULE_LICENSE("GPL"); 66MODULE_LICENSE("GPL");
68 67
68static DEFINE_MUTEX(cciss_mutex);
69static int cciss_allow_hpsa; 69static int cciss_allow_hpsa;
70module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR); 70module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
71MODULE_PARM_DESC(cciss_allow_hpsa, 71MODULE_PARM_DESC(cciss_allow_hpsa,
@@ -1059,9 +1059,9 @@ static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode)
1059{ 1059{
1060 int ret; 1060 int ret;
1061 1061
1062 lock_kernel(); 1062 mutex_lock(&cciss_mutex);
1063 ret = cciss_open(bdev, mode); 1063 ret = cciss_open(bdev, mode);
1064 unlock_kernel(); 1064 mutex_unlock(&cciss_mutex);
1065 1065
1066 return ret; 1066 return ret;
1067} 1067}
@@ -1074,13 +1074,13 @@ static int cciss_release(struct gendisk *disk, fmode_t mode)
1074 ctlr_info_t *h; 1074 ctlr_info_t *h;
1075 drive_info_struct *drv; 1075 drive_info_struct *drv;
1076 1076
1077 lock_kernel(); 1077 mutex_lock(&cciss_mutex);
1078 h = get_host(disk); 1078 h = get_host(disk);
1079 drv = get_drv(disk); 1079 drv = get_drv(disk);
1080 dev_dbg(&h->pdev->dev, "cciss_release %s\n", disk->disk_name); 1080 dev_dbg(&h->pdev->dev, "cciss_release %s\n", disk->disk_name);
1081 drv->usage_count--; 1081 drv->usage_count--;
1082 h->usage_count--; 1082 h->usage_count--;
1083 unlock_kernel(); 1083 mutex_unlock(&cciss_mutex);
1084 return 0; 1084 return 0;
1085} 1085}
1086 1086
@@ -1088,9 +1088,9 @@ static int do_ioctl(struct block_device *bdev, fmode_t mode,
1088 unsigned cmd, unsigned long arg) 1088 unsigned cmd, unsigned long arg)
1089{ 1089{
1090 int ret; 1090 int ret;
1091 lock_kernel(); 1091 mutex_lock(&cciss_mutex);
1092 ret = cciss_ioctl(bdev, mode, cmd, arg); 1092 ret = cciss_ioctl(bdev, mode, cmd, arg);
1093 unlock_kernel(); 1093 mutex_unlock(&cciss_mutex);
1094 return ret; 1094 return ret;
1095} 1095}
1096 1096