diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-02 14:28:52 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-05 15:01:10 +0200 |
commit | 2a48fc0ab24241755dc93bfd4f01d68efab47f5a (patch) | |
tree | fa9ae10ce89b26b7d8ae9ce24bdfda5e3007b763 /drivers/block/DAC960.c | |
parent | drivers: autoconvert trivial BKL users to private mutex (diff) | |
download | linux-2a48fc0ab24241755dc93bfd4f01d68efab47f5a.tar.xz linux-2a48fc0ab24241755dc93bfd4f01d68efab47f5a.zip |
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 @@ #include <linux/ioport.h> #include <linux/mm.h> #include <linux/slab.h> -#include <linux/smp_lock.h> +#include <linux/mutex.h> #include <linux/proc_fs.h> #include <linux/seq_file.h> #include <linux/reboot.h> @@ -54,6 +54,7 @@ #define DAC960_GAM_MINOR 252 +static DEFINE_MUTEX(DAC960_mutex); static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers]; static int DAC960_ControllerCount; static struct proc_dir_entry *DAC960_ProcDirectoryEntry; @@ -81,7 +82,7 @@ static int DAC960_open(struct block_device *bdev, fmode_t mode) int drive_nr = (long)disk->private_data; int ret = -ENXIO; - lock_kernel(); + mutex_lock(&DAC960_mutex); if (p->FirmwareType == DAC960_V1_Controller) { if (p->V1.LogicalDriveInformation[drive_nr]. LogicalDriveState == DAC960_V1_LogicalDrive_Offline) @@ -99,7 +100,7 @@ static int DAC960_open(struct block_device *bdev, fmode_t mode) goto out; ret = 0; out: - unlock_kernel(); + mutex_unlock(&DAC960_mutex); return ret; } @@ -6625,7 +6626,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, long ErrorCode = 0; if (!capable(CAP_SYS_ADMIN)) return -EACCES; - lock_kernel(); + mutex_lock(&DAC960_mutex); switch (Request) { case DAC960_IOCTL_GET_CONTROLLER_COUNT: @@ -7056,7 +7057,7 @@ static long DAC960_gam_ioctl(struct file *file, unsigned int Request, default: ErrorCode = -ENOTTY; } - unlock_kernel(); + mutex_unlock(&DAC960_mutex); return ErrorCode; } |