diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-02 08:28:52 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-05 09:01:10 -0400 |
commit | 2a48fc0ab24241755dc93bfd4f01d68efab47f5a (patch) | |
tree | fa9ae10ce89b26b7d8ae9ce24bdfda5e3007b763 /drivers/block/DAC960.c | |
parent | 613655fa39ff6957754fa8ceb8559980920eb8ee (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/DAC960.c')
-rw-r--r-- | drivers/block/DAC960.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 4e2c367fec11..da0f6ddd7621 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | 39 | #include <linux/mutex.h> |
40 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
41 | #include <linux/seq_file.h> | 41 | #include <linux/seq_file.h> |
42 | #include <linux/reboot.h> | 42 | #include <linux/reboot.h> |
@@ -54,6 +54,7 @@ | |||
54 | #define DAC960_GAM_MINOR 252 | 54 | #define DAC960_GAM_MINOR 252 |
55 | 55 | ||
56 | 56 | ||
57 | static DEFINE_MUTEX(DAC960_mutex); | ||
57 | static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers]; | 58 | static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers]; |
58 | static int DAC960_ControllerCount; | 59 | static int DAC960_ControllerCount; |
59 | static struct proc_dir_entry *DAC960_ProcDirectoryEntry; | 60 | static struct proc_dir_entry *DAC960_ProcDirectoryEntry; |
@@ -81,7 +82,7 @@ static int DAC960_open(struct block_device *bdev, fmode_t mode) | |||
81 | int drive_nr = (long)disk->private_data; | 82 | int drive_nr = (long)disk->private_data; |
82 | int ret = -ENXIO; | 83 | int ret = -ENXIO; |
83 | 84 | ||
84 | lock_kernel(); | 85 | mutex_lock(&DAC960_mutex); |
85 | if (p->FirmwareType == DAC960_V1_Controller) { | 86 | if (p->FirmwareType == DAC960_V1_Controller) { |
86 | if (p->V1.LogicalDriveInformation[drive_nr]. | 87 | if (p->V1.LogicalDriveInformation[drive_nr]. |
87 | LogicalDriveState == DAC960_V1_LogicalDrive_Offline) | 88 | LogicalDriveState == DAC960_V1_LogicalDrive_Offline) |
@@ -99,7 +100,7 @@ static int DAC960_open(struct block_device *bdev, fmode_t mode) | |||
99 | goto out; | 100 | goto out; |
100 | ret = 0; | 101 | ret = 0; |
101 | out: | 102 | out: |
102 | unlock_kernel(); | 103 | mutex_unlock(&DAC960_mutex); |
103 | return ret; | 104 | return ret; |
104 | } | 105 | } |
105 | 106 | ||
@@ -6625,7 +6626,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, | |||
6625 | long ErrorCode = 0; | 6626 | long ErrorCode = 0; |
6626 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; | 6627 | if (!capable(CAP_SYS_ADMIN)) return -EACCES; |
6627 | 6628 | ||
6628 | lock_kernel(); | 6629 | mutex_lock(&DAC960_mutex); |
6629 | switch (Request) | 6630 | switch (Request) |
6630 | { | 6631 | { |
6631 | case DAC960_IOCTL_GET_CONTROLLER_COUNT: | 6632 | case DAC960_IOCTL_GET_CONTROLLER_COUNT: |
@@ -7056,7 +7057,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, | |||
7056 | default: | 7057 | default: |
7057 | ErrorCode = -ENOTTY; | 7058 | ErrorCode = -ENOTTY; |
7058 | } | 7059 | } |
7059 | unlock_kernel(); | 7060 | mutex_unlock(&DAC960_mutex); |
7060 | return ErrorCode; | 7061 | return ErrorCode; |
7061 | } | 7062 | } |
7062 | 7063 | ||