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/viodasd.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/viodasd.c')
-rw-r--r-- | drivers/block/viodasd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index f651e51a3319..e2ff697697c2 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/string.h> | 43 | #include <linux/string.h> |
44 | #include <linux/smp_lock.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/dma-mapping.h> | 45 | #include <linux/dma-mapping.h> |
46 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
47 | #include <linux/device.h> | 47 | #include <linux/device.h> |
@@ -73,6 +73,7 @@ enum { | |||
73 | MAX_DISK_NAME = FIELD_SIZEOF(struct gendisk, disk_name) | 73 | MAX_DISK_NAME = FIELD_SIZEOF(struct gendisk, disk_name) |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static DEFINE_MUTEX(viodasd_mutex); | ||
76 | static DEFINE_SPINLOCK(viodasd_spinlock); | 77 | static DEFINE_SPINLOCK(viodasd_spinlock); |
77 | 78 | ||
78 | #define VIOMAXREQ 16 | 79 | #define VIOMAXREQ 16 |
@@ -180,9 +181,9 @@ static int viodasd_unlocked_open(struct block_device *bdev, fmode_t mode) | |||
180 | { | 181 | { |
181 | int ret; | 182 | int ret; |
182 | 183 | ||
183 | lock_kernel(); | 184 | mutex_lock(&viodasd_mutex); |
184 | ret = viodasd_open(bdev, mode); | 185 | ret = viodasd_open(bdev, mode); |
185 | unlock_kernel(); | 186 | mutex_unlock(&viodasd_mutex); |
186 | 187 | ||
187 | return ret; | 188 | return ret; |
188 | } | 189 | } |
@@ -196,7 +197,7 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode) | |||
196 | struct viodasd_device *d = disk->private_data; | 197 | struct viodasd_device *d = disk->private_data; |
197 | HvLpEvent_Rc hvrc; | 198 | HvLpEvent_Rc hvrc; |
198 | 199 | ||
199 | lock_kernel(); | 200 | mutex_lock(&viodasd_mutex); |
200 | /* Send the event to OS/400. We DON'T expect a response */ | 201 | /* Send the event to OS/400. We DON'T expect a response */ |
201 | hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, | 202 | hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, |
202 | HvLpEvent_Type_VirtualIo, | 203 | HvLpEvent_Type_VirtualIo, |
@@ -210,7 +211,7 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode) | |||
210 | if (hvrc != 0) | 211 | if (hvrc != 0) |
211 | pr_warning("HV close call failed %d\n", (int)hvrc); | 212 | pr_warning("HV close call failed %d\n", (int)hvrc); |
212 | 213 | ||
213 | unlock_kernel(); | 214 | mutex_unlock(&viodasd_mutex); |
214 | 215 | ||
215 | return 0; | 216 | return 0; |
216 | } | 217 | } |