summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-04-04 13:59:12 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-05 21:33:20 (GMT)
commitf3abc831386e3606fbb21acf0ee5231df0d0185f (patch)
tree483bb4cced3c62813fbbafb370c24ef95de3bdc9 /drivers
parent5e04c25435e2cf0049def6ab4c28e49494a68dde (diff)
downloadlinux-fsl-qoriq-f3abc831386e3606fbb21acf0ee5231df0d0185f.tar.xz
staging: comedi: refactor comedi_dev_from_minor()
Refactor `comedi_dev_from_minor()` to call one of two new functions `comedi_dev_from_board_minor()` (for minor device numbers less than `COMEDI_NUM_BOARD_MINORS`) or `comedi_dev_from_subdevice_minor()` (for minor device numbers greater than or equal to `COMEDI_NUM_BOARD_MINORS`, which are subdevice minor device numbers). Remove `comedi_file_info_from_minor()` as it is no longer used. This is a step towards removing `struct comedi_file_info`. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/comedi_fops.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index beb579d..5f3b152 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -190,23 +190,34 @@ static struct comedi_file_info
return info;
}
-static struct comedi_file_info *comedi_file_info_from_minor(unsigned minor)
-{
- if (minor < COMEDI_NUM_BOARD_MINORS)
- return comedi_file_info_from_board_minor(minor);
- else
- return comedi_file_info_from_subdevice_minor(minor);
-}
-
static struct comedi_device *
comedi_dev_from_file_info(struct comedi_file_info *info)
{
return info ? info->device : NULL;
}
+static struct comedi_device *comedi_dev_from_board_minor(unsigned minor)
+{
+ struct comedi_file_info *info;
+
+ info = comedi_file_info_from_board_minor(minor);
+ return comedi_dev_from_file_info(info);
+}
+
+static struct comedi_device *comedi_dev_from_subdevice_minor(unsigned minor)
+{
+ struct comedi_file_info *info;
+
+ info = comedi_file_info_from_subdevice_minor(minor);
+ return comedi_dev_from_file_info(info);
+}
+
struct comedi_device *comedi_dev_from_minor(unsigned minor)
{
- return comedi_dev_from_file_info(comedi_file_info_from_minor(minor));
+ if (minor < COMEDI_NUM_BOARD_MINORS)
+ return comedi_dev_from_board_minor(minor);
+ else
+ return comedi_dev_from_subdevice_minor(minor);
}
EXPORT_SYMBOL_GPL(comedi_dev_from_minor);