summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2012-12-19 23:35:23 +0100
committerGreg Kroah-Hartman2013-01-07 23:25:46 +0100
commit4da5fa9a439fda3019585aecab44462fd641b6f8 (patch)
treed9d10ba2f73869cba60a66b605c3f40d154f3c48 /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: comedi_fops: introduce comedi_dev_from_minor() (diff)
downloadkernel-qcow2-linux-4da5fa9a439fda3019585aecab44462fd641b6f8.tar.gz
kernel-qcow2-linux-4da5fa9a439fda3019585aecab44462fd641b6f8.tar.xz
kernel-qcow2-linux-4da5fa9a439fda3019585aecab44462fd641b6f8.zip
staging: comedi: use comedi_dev_from_minor()
Remove the need to export comedi_get_device_file_info() by using the new helper comedi_dev_from_minor(). This will also allow us to make the comedi_device_file_info struct private. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_fops.c')
-rw-r--r--drivers/staging/comedi/comedi_fops.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 647c7f347ee0..3945b5f0e5fa 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1608,14 +1608,11 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info =
- comedi_get_device_file_info(minor);
- struct comedi_device *dev;
+ struct comedi_device *dev = comedi_dev_from_minor(minor);
int rc;
- if (dev_file_info == NULL || dev_file_info->device == NULL)
+ if (!dev)
return -ENODEV;
- dev = dev_file_info->device;
mutex_lock(&dev->mutex);
@@ -2088,12 +2085,9 @@ done:
static int comedi_open(struct inode *inode, struct file *file)
{
const unsigned minor = iminor(inode);
- struct comedi_device_file_info *dev_file_info =
- comedi_get_device_file_info(minor);
- struct comedi_device *dev =
- dev_file_info ? dev_file_info->device : NULL;
+ struct comedi_device *dev = comedi_dev_from_minor(minor);
- if (dev == NULL) {
+ if (!dev) {
DPRINTK("invalid minor number\n");
return -ENODEV;
}
@@ -2168,14 +2162,9 @@ ok:
static int comedi_fasync(int fd, struct file *file, int on)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
- struct comedi_device_file_info *dev_file_info;
- struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
+ struct comedi_device *dev = comedi_dev_from_minor(minor);
- if (dev_file_info == NULL)
- return -ENODEV;
- dev = dev_file_info->device;
- if (dev == NULL)
+ if (!dev)
return -ENODEV;
return fasync_helper(fd, file, on, &dev->async_queue);
@@ -2184,16 +2173,11 @@ static int comedi_fasync(int fd, struct file *file, int on)
static int comedi_close(struct inode *inode, struct file *file)
{
const unsigned minor = iminor(inode);
+ struct comedi_device *dev = comedi_dev_from_minor(minor);
struct comedi_subdevice *s = NULL;
int i;
- struct comedi_device_file_info *dev_file_info;
- struct comedi_device *dev;
- dev_file_info = comedi_get_device_file_info(minor);
- if (dev_file_info == NULL)
- return -ENODEV;
- dev = dev_file_info->device;
- if (dev == NULL)
+ if (!dev)
return -ENODEV;
mutex_lock(&dev->mutex);