summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_fops.c
diff options
context:
space:
mode:
authorH Hartley Sweeten2012-12-19 23:34:40 +0100
committerGreg Kroah-Hartman2013-01-07 23:25:46 +0100
commit85104e9b409013c78624b367dec02e6ccc996635 (patch)
tree60e4bdb4ecfa319df2a80625a0de7397d196e7fa /drivers/staging/comedi/comedi_fops.c
parentstaging: comedi: don't expose comedi_get_{read, write}_subdevice (diff)
downloadkernel-qcow2-linux-85104e9b409013c78624b367dec02e6ccc996635.tar.gz
kernel-qcow2-linux-85104e9b409013c78624b367dec02e6ccc996635.tar.xz
kernel-qcow2-linux-85104e9b409013c78624b367dec02e6ccc996635.zip
staging: comedi: comedi_fops: introduce comedi_dev_from_minor()
A number of functions have to call comedi_get_device_file_info() to get the comedi_device_file_info pointer for a given minor. That pointer is only used to get the actual comedi_device pointer for the minor. Introduce a new helper function, comedi_dev_from_minor(), to simplify this operation. 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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 38de7f70f0b8..647c7f347ee0 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -90,6 +90,16 @@ static DEFINE_SPINLOCK(comedi_file_info_table_lock);
static struct comedi_device_file_info
*comedi_file_info_table[COMEDI_NUM_MINORS];
+struct comedi_device *comedi_dev_from_minor(unsigned minor)
+{
+ struct comedi_device_file_info *info;
+
+ info = comedi_get_device_file_info(minor);
+
+ return info ? info->device : NULL;
+}
+EXPORT_SYMBOL_GPL(comedi_dev_from_minor);
+
static struct comedi_subdevice *
comedi_get_read_subdevice(const struct comedi_device_file_info *info)
{