]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: comedi_fops: absorb comedi_free_board_minor()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 10 Aug 2015 20:13:59 +0000 (13:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Aug 2015 01:35:49 +0000 (18:35 -0700)
This function is only called by comedi_cleanup_board_minors() and the
'minor' parameter will always be < COMEDI_NUM_BOARD_MINORS.

For aesthetics, absorb the function and remove the unnecessary BUG_ON().

Split the comedi_clear_board_minor() out to clarify that the return value
is a comedi_device pointer.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c

index f7db91ca974e56f8c6d6287df1bcb56f7a8cbd15..fd54d098ab02248eabff1b250afc123b27433260 100644 (file)
@@ -2774,12 +2774,6 @@ struct comedi_device *comedi_alloc_board_minor(struct device *hardware_device)
        return dev;
 }
 
-static void comedi_free_board_minor(unsigned minor)
-{
-       BUG_ON(minor >= COMEDI_NUM_BOARD_MINORS);
-       comedi_free_board_dev(comedi_clear_board_minor(minor));
-}
-
 void comedi_release_hardware_device(struct device *hardware_device)
 {
        int minor;
@@ -2852,10 +2846,13 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s)
 
 static void comedi_cleanup_board_minors(void)
 {
+       struct comedi_device *dev;
        unsigned i;
 
-       for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++)
-               comedi_free_board_minor(i);
+       for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
+               dev = comedi_clear_board_minor(i);
+               comedi_free_board_dev(dev);
+       }
 }
 
 static int __init comedi_init(void)