aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-03-23 06:00:38 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-23 10:38:12 -0500
commitf85221dd74f2708b78a2aa54de59944e44206d0e (patch)
treef9e9710f78bf56515b04101bb40087b50e4bfeb6
parent0ac1759abc69fb62438c30a7e422f628a1120d67 (diff)
[PATCH] sem2mutex: drivers/block/loop.c
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/block/loop.c18
-rw-r--r--include/linux/loop.h3
2 files changed, 11 insertions, 10 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 0010704739e3..74bf0255e98f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1144,7 +1144,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
1144 struct loop_device *lo = inode->i_bdev->bd_disk->private_data; 1144 struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
1145 int err; 1145 int err;
1146 1146
1147 down(&lo->lo_ctl_mutex); 1147 mutex_lock(&lo->lo_ctl_mutex);
1148 switch (cmd) { 1148 switch (cmd) {
1149 case LOOP_SET_FD: 1149 case LOOP_SET_FD:
1150 err = loop_set_fd(lo, file, inode->i_bdev, arg); 1150 err = loop_set_fd(lo, file, inode->i_bdev, arg);
@@ -1170,7 +1170,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
1170 default: 1170 default:
1171 err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL; 1171 err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
1172 } 1172 }
1173 up(&lo->lo_ctl_mutex); 1173 mutex_unlock(&lo->lo_ctl_mutex);
1174 return err; 1174 return err;
1175} 1175}
1176 1176
@@ -1178,9 +1178,9 @@ static int lo_open(struct inode *inode, struct file *file)
1178{ 1178{
1179 struct loop_device *lo = inode->i_bdev->bd_disk->private_data; 1179 struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
1180 1180
1181 down(&lo->lo_ctl_mutex); 1181 mutex_lock(&lo->lo_ctl_mutex);
1182 lo->lo_refcnt++; 1182 lo->lo_refcnt++;
1183 up(&lo->lo_ctl_mutex); 1183 mutex_unlock(&lo->lo_ctl_mutex);
1184 1184
1185 return 0; 1185 return 0;
1186} 1186}
@@ -1189,9 +1189,9 @@ static int lo_release(struct inode *inode, struct file *file)
1189{ 1189{
1190 struct loop_device *lo = inode->i_bdev->bd_disk->private_data; 1190 struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
1191 1191
1192 down(&lo->lo_ctl_mutex); 1192 mutex_lock(&lo->lo_ctl_mutex);
1193 --lo->lo_refcnt; 1193 --lo->lo_refcnt;
1194 up(&lo->lo_ctl_mutex); 1194 mutex_unlock(&lo->lo_ctl_mutex);
1195 1195
1196 return 0; 1196 return 0;
1197} 1197}
@@ -1233,12 +1233,12 @@ int loop_unregister_transfer(int number)
1233 xfer_funcs[n] = NULL; 1233 xfer_funcs[n] = NULL;
1234 1234
1235 for (lo = &loop_dev[0]; lo < &loop_dev[max_loop]; lo++) { 1235 for (lo = &loop_dev[0]; lo < &loop_dev[max_loop]; lo++) {
1236 down(&lo->lo_ctl_mutex); 1236 mutex_lock(&lo->lo_ctl_mutex);
1237 1237
1238 if (lo->lo_encryption == xfer) 1238 if (lo->lo_encryption == xfer)
1239 loop_release_xfer(lo); 1239 loop_release_xfer(lo);
1240 1240
1241 up(&lo->lo_ctl_mutex); 1241 mutex_unlock(&lo->lo_ctl_mutex);
1242 } 1242 }
1243 1243
1244 return 0; 1244 return 0;
@@ -1285,7 +1285,7 @@ static int __init loop_init(void)
1285 lo->lo_queue = blk_alloc_queue(GFP_KERNEL); 1285 lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
1286 if (!lo->lo_queue) 1286 if (!lo->lo_queue)
1287 goto out_mem4; 1287 goto out_mem4;
1288 init_MUTEX(&lo->lo_ctl_mutex); 1288 mutex_init(&lo->lo_ctl_mutex);
1289 init_completion(&lo->lo_done); 1289 init_completion(&lo->lo_done);
1290 init_completion(&lo->lo_bh_done); 1290 init_completion(&lo->lo_bh_done);
1291 lo->lo_number = i; 1291 lo->lo_number = i;
diff --git a/include/linux/loop.h b/include/linux/loop.h
index f96506782ebe..e76c7611d6cc 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -17,6 +17,7 @@
17#include <linux/bio.h> 17#include <linux/bio.h>
18#include <linux/blkdev.h> 18#include <linux/blkdev.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/mutex.h>
20 21
21/* Possible states of device */ 22/* Possible states of device */
22enum { 23enum {
@@ -60,7 +61,7 @@ struct loop_device {
60 int lo_state; 61 int lo_state;
61 struct completion lo_done; 62 struct completion lo_done;
62 struct completion lo_bh_done; 63 struct completion lo_bh_done;
63 struct semaphore lo_ctl_mutex; 64 struct mutex lo_ctl_mutex;
64 int lo_pending; 65 int lo_pending;
65 66
66 request_queue_t *lo_queue; 67 request_queue_t *lo_queue;