staging: comedi: addi_apci_3120: remove check in apci3120_setup_chan_list()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:54:44 +0000 (10:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:34:02 +0000 (09:34 -0800)
The n_chan check is not needed. This value will always be >= 1. Remove
the unnecessary check.

For aesthetics, rename the function and change it's return type to void.

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/drivers/addi-data/hwdrv_apci3120.c
drivers/staging/comedi/drivers/addi_apci_3120.c

index 28c5792f0e90915ea98f72f71739ce6dea9a3f3d..3c172466a3c014458ea60c914790bef855b42f09 100644 (file)
@@ -96,19 +96,13 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
 
 #define APCI3120_COUNTER               3
 
-static int apci3120_setup_chan_list(struct comedi_device *dev,
-                                   struct comedi_subdevice *s,
-                                   int n_chan, unsigned int *chanlist)
+static void apci3120_set_chanlist(struct comedi_device *dev,
+                                 struct comedi_subdevice *s,
+                                 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) {
-               dev_err(dev->class_dev, "range/channel list is empty!\n");
-               return 0;
-       }
-
        /* set scan length (PR) and scan start (PA) */
        devpriv->ctrl = APCI3120_CTRL_PR(n_chan - 1) | APCI3120_CTRL_PA(0);
        outw(devpriv->ctrl, dev->iobase + APCI3120_CTRL_REG);
@@ -128,7 +122,6 @@ static int apci3120_setup_chan_list(struct comedi_device *dev,
 
                outw(val, dev->iobase + APCI3120_CHANLIST_REG);
        }
-       return 1;               /*  we can serve this with scan logic */
 }
 
 static int apci3120_reset(struct comedi_device *dev)
@@ -288,10 +281,8 @@ static int apci3120_cyclic_ai(int mode,
 
        devpriv->ui_DmaActualBuffer = 0;
 
-       /* Initializes the sequence array */
-       if (!apci3120_setup_chan_list(dev, s, cmd->chanlist_len,
-                       cmd->chanlist))
-               return -EINVAL;
+       /* load chanlist for command scan */
+       apci3120_set_chanlist(dev, s, cmd->chanlist_len, cmd->chanlist);
 
        divisor0 = apci3120_ns_to_timer(dev, 0, cmd->convert_arg, cmd->flags);
        if (mode == 2) {
index 70363faa99d6dde956815274ec26d59b13f61ac6..d40fdf2219a5357fcba5a430b9a0e57d46cb351a 100644 (file)
@@ -310,8 +310,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev,
        outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
 
        /* load chanlist for single channel scan */
-       if (!apci3120_setup_chan_list(dev, s, 1, &insn->chanspec))
-               return -EINVAL;
+       apci3120_set_chanlist(dev, s, 1, &insn->chanspec);
 
        /*
         * Timer 0 is used in MODE4 (software triggered strobe) to set the