From: H Hartley Sweeten Date: Tue, 4 Nov 2014 17:54:44 +0000 (-0700) Subject: staging: comedi: addi_apci_3120: remove check in apci3120_setup_chan_list() X-Git-Tag: v3.19-rc1~66^2~295 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0a3e518102b4a252dfcfe7d602d6e99e8c77d230;p=karo-tx-linux.git staging: comedi: addi_apci_3120: remove check in apci3120_setup_chan_list() 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 Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 28c5792f0e90..3c172466a3c0 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -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) { diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 70363faa99d6..d40fdf2219a5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -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