[PATCH 026/108] staging: comedi: addi_apci_3120: remove 'check' param from apci3120_setup_chan_list()

H Hartley Sweeten hsweeten at visionengravers.com
Tue Nov 4 17:54:10 UTC 2014


This parameter is always passed as '0'. Remove it and refactor the code.

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 .../comedi/drivers/addi-data/hwdrv_apci3120.c      | 23 +++++-----------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index dd7805b..44a3fcd 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -188,31 +188,18 @@ static int apci3120_ai_insn_config(struct comedi_device *dev,
 	return insn->n;
 }
 
-/*
- * This function will first check channel list is ok or not and then
- * initialize the sequence RAM with the polarity, Gain,Channel number.
- * If the last argument of function "check"is 1 then it only checks
- * the channel list is ok or not.
- */
 static int apci3120_setup_chan_list(struct comedi_device *dev,
 				    struct comedi_subdevice *s,
-				    int n_chan,
-				    unsigned int *chanlist,
-				    char check)
+				    int n_chan, unsigned int *chanlist)
 {
 	struct apci3120_private *devpriv = dev->private;
 	int i;
 
 	/* correct channel and range number check itself comedi/range.c */
 	if (n_chan < 1) {
-		if (!check)
-			dev_err(dev->class_dev,
-				"range/channel list is empty!\n");
+		dev_err(dev->class_dev, "range/channel list is empty!\n");
 		return 0;
 	}
-	/*  All is ok, so we can setup channel/range list */
-	if (check)
-		return 1;
 
 	/* set scan length (PR) and scan start (PA) */
 	devpriv->ctrl = APCI3120_CTRL_PR(n_chan - 1) | APCI3120_CTRL_PA(0);
@@ -282,7 +269,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev,
 
 			/*  Initialize the sequence array */
 			if (!apci3120_setup_chan_list(dev, s, 1,
-					&insn->chanspec, 0))
+					&insn->chanspec))
 				return -EINVAL;
 
 			/* Initialize Timer 0 mode 4 */
@@ -347,7 +334,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev,
 
 			if (!apci3120_setup_chan_list(dev, s,
 					devpriv->ui_AiNbrofChannels,
-					devpriv->ui_AiChannelList, 0))
+					devpriv->ui_AiChannelList))
 				return -EINVAL;
 
 			/* Initialize Timer 0 mode 2 */
@@ -594,7 +581,7 @@ static int apci3120_cyclic_ai(int mode,
 
 	/* Initializes the sequence array */
 	if (!apci3120_setup_chan_list(dev, s, devpriv->ui_AiNbrofChannels,
-			cmd->chanlist, 0))
+			cmd->chanlist))
 		return -EINVAL;
 
 	divisor0 = apci3120_ns_to_timer(dev, 0, cmd->convert_arg, cmd->flags);
-- 
2.0.3



More information about the devel mailing list