Commit 0a3e5181 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6a51cfc6
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
@@ -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,
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) {
+1 −2
Original line number Diff line number Diff line
@@ -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