diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-03-23 03:00:21 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 07:38:10 -0800 |
commit | 8ed965d612d9e9bc08805c75123f063cf6966311 (patch) | |
tree | 7a863b9cb0d408295193f888b06d40d3364a404a /drivers/char/raw.c | |
parent | 9cdf18279d1f4a2d075ebe924d74e6e4547f6e1b (diff) | |
download | blackbird-op-linux-8ed965d612d9e9bc08805c75123f063cf6966311.tar.gz blackbird-op-linux-8ed965d612d9e9bc08805c75123f063cf6966311.zip |
[PATCH] sem2mutex: drivers: raw, connector, dcdbas, ppp_generic
Semaphore to mutex conversion.
The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/raw.c')
-rw-r--r-- | drivers/char/raw.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 30e4cbe16bb0..15a7b4086524 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -19,6 +19,7 @@ #include <linux/uio.h> #include <linux/cdev.h> #include <linux/device.h> +#include <linux/mutex.h> #include <asm/uaccess.h> @@ -29,7 +30,7 @@ struct raw_device_data { static struct class *raw_class; static struct raw_device_data raw_devices[MAX_RAW_MINORS]; -static DECLARE_MUTEX(raw_mutex); +static DEFINE_MUTEX(raw_mutex); static struct file_operations raw_ctl_fops; /* forward declaration */ /* @@ -53,7 +54,7 @@ static int raw_open(struct inode *inode, struct file *filp) return 0; } - down(&raw_mutex); + mutex_lock(&raw_mutex); /* * All we need to do on open is check that the device is bound. @@ -78,7 +79,7 @@ static int raw_open(struct inode *inode, struct file *filp) filp->f_dentry->d_inode->i_mapping = bdev->bd_inode->i_mapping; filp->private_data = bdev; - up(&raw_mutex); + mutex_unlock(&raw_mutex); return 0; out2: @@ -86,7 +87,7 @@ out2: out1: blkdev_put(bdev); out: - up(&raw_mutex); + mutex_unlock(&raw_mutex); return err; } @@ -99,14 +100,14 @@ static int raw_release(struct inode *inode, struct file *filp) const int minor= iminor(inode); struct block_device *bdev; - down(&raw_mutex); + mutex_lock(&raw_mutex); bdev = raw_devices[minor].binding; if (--raw_devices[minor].inuse == 0) { /* Here inode->i_mapping == bdev->bd_inode->i_mapping */ inode->i_mapping = &inode->i_data; inode->i_mapping->backing_dev_info = &default_backing_dev_info; } - up(&raw_mutex); + mutex_unlock(&raw_mutex); bd_release(bdev); blkdev_put(bdev); @@ -187,9 +188,9 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, goto out; } - down(&raw_mutex); + mutex_lock(&raw_mutex); if (rawdev->inuse) { - up(&raw_mutex); + mutex_unlock(&raw_mutex); err = -EBUSY; goto out; } @@ -211,11 +212,11 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, bind_device(&rq); } } - up(&raw_mutex); + mutex_unlock(&raw_mutex); } else { struct block_device *bdev; - down(&raw_mutex); + mutex_lock(&raw_mutex); bdev = rawdev->binding; if (bdev) { rq.block_major = MAJOR(bdev->bd_dev); @@ -223,7 +224,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, } else { rq.block_major = rq.block_minor = 0; } - up(&raw_mutex); + mutex_unlock(&raw_mutex); if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) { err = -EFAULT; goto out; |