From: H Hartley Sweeten Date: Mon, 10 Aug 2015 20:13:59 +0000 (-0700) Subject: staging: comedi: comedi_fops: absorb comedi_free_board_minor() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2be8ae5898af956560e9f722b327add05574a1f7;p=linux-beck.git staging: comedi: comedi_fops: absorb comedi_free_board_minor() 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index f7db91ca974e..fd54d098ab02 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c @@ -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)