Commit f85221dd authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds
Browse files

[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: default avatarIngo Molnar <mingo@elte.hu>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0ac1759a
......@@ -1144,7 +1144,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
int err;
down(&lo->lo_ctl_mutex);
mutex_lock(&lo->lo_ctl_mutex);
switch (cmd) {
case LOOP_SET_FD:
err = loop_set_fd(lo, file, inode->i_bdev, arg);
......@@ -1170,7 +1170,7 @@ static int lo_ioctl(struct inode * inode, struct file * file,
default:
err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
}
up(&lo->lo_ctl_mutex);
mutex_unlock(&lo->lo_ctl_mutex);
return err;
}
......@@ -1178,9 +1178,9 @@ static int lo_open(struct inode *inode, struct file *file)
{
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
down(&lo->lo_ctl_mutex);
mutex_lock(&lo->lo_ctl_mutex);
lo->lo_refcnt++;
up(&lo->lo_ctl_mutex);
mutex_unlock(&lo->lo_ctl_mutex);
return 0;
}
......@@ -1189,9 +1189,9 @@ static int lo_release(struct inode *inode, struct file *file)
{
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
down(&lo->lo_ctl_mutex);
mutex_lock(&lo->lo_ctl_mutex);
--lo->lo_refcnt;
up(&lo->lo_ctl_mutex);
mutex_unlock(&lo->lo_ctl_mutex);
return 0;
}
......@@ -1233,12 +1233,12 @@ int loop_unregister_transfer(int number)
xfer_funcs[n] = NULL;
for (lo = &loop_dev[0]; lo < &loop_dev[max_loop]; lo++) {
down(&lo->lo_ctl_mutex);
mutex_lock(&lo->lo_ctl_mutex);
if (lo->lo_encryption == xfer)
loop_release_xfer(lo);
up(&lo->lo_ctl_mutex);
mutex_unlock(&lo->lo_ctl_mutex);
}
return 0;
......@@ -1285,7 +1285,7 @@ static int __init loop_init(void)
lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
if (!lo->lo_queue)
goto out_mem4;
init_MUTEX(&lo->lo_ctl_mutex);
mutex_init(&lo->lo_ctl_mutex);
init_completion(&lo->lo_done);
init_completion(&lo->lo_bh_done);
lo->lo_number = i;
......
......@@ -17,6 +17,7 @@
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
/* Possible states of device */
enum {
......@@ -60,7 +61,7 @@ struct loop_device {
int lo_state;
struct completion lo_done;
struct completion lo_bh_done;
struct semaphore lo_ctl_mutex;
struct mutex lo_ctl_mutex;
int lo_pending;
request_queue_t *lo_queue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment