Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

staging: comedi: pcl812: clarify pcl812_reset()



Instead of using the 'board_type' and the switch, use the boardinfo
to determine what should be reset.

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 1be6b015
Loading
Loading
Loading
Loading
+18 −24
Original line number Original line Diff line number Diff line
@@ -1107,6 +1107,16 @@ static void pcl812_reset(struct comedi_device *dev)
{
{
	const struct pcl812_board *board = comedi_board(dev);
	const struct pcl812_board *board = comedi_board(dev);
	struct pcl812_private *devpriv = dev->private;
	struct pcl812_private *devpriv = dev->private;
	unsigned int chan;

	/* disable analog input trigger */
	outb(devpriv->mode_reg_int | PCL812_CTRL_DISABLE_TRIG,
	     dev->iobase + PCL812_CTRL_REG);
	pcl812_ai_clear_eoc(dev);

	/* stop pacer */
	if (board->IRQbits)
		pcl812_start_pacer(dev, false);


	/*
	/*
	 * Invalidate last_ai_chanspec then set analog input to
	 * Invalidate last_ai_chanspec then set analog input to
@@ -1115,33 +1125,17 @@ static void pcl812_reset(struct comedi_device *dev)
	devpriv->last_ai_chanspec = CR_PACK(16, 0, 0);
	devpriv->last_ai_chanspec = CR_PACK(16, 0, 0);
	pcl812_ai_set_chan_range(dev, CR_PACK(0, 0, 0), 0);
	pcl812_ai_set_chan_range(dev, CR_PACK(0, 0, 0), 0);


	switch (board->board_type) {
	/* set analog output channels to 0V */
	case boardPCL812PG:
	for (chan = 0; chan < board->n_aochan; chan++) {
	case boardPCL812:
		outb(0, dev->iobase + PCL812_AO_LSB_REG(chan));
	case boardACL8112:
		outb(0, dev->iobase + PCL812_AO_MSB_REG(chan));
	case boardACL8216:
	}
		/* set analog output channel 1 to 0V */

		outb(0, dev->iobase + PCL812_AO_LSB_REG(1));
	/* set all digital outputs low */
		outb(0, dev->iobase + PCL812_AO_MSB_REG(1));
	if (board->has_dio) {
	case boardA821:
		/* set analog output channel 0 to 0V */
		outb(0, dev->iobase + PCL812_AO_LSB_REG(0));
		outb(0, dev->iobase + PCL812_AO_MSB_REG(0));
		pcl812_start_pacer(dev, false);
		outb(0, dev->iobase + PCL812_DO_MSB_REG);
		outb(0, dev->iobase + PCL812_DO_MSB_REG);
		outb(0, dev->iobase + PCL812_DO_LSB_REG);
		outb(0, dev->iobase + PCL812_DO_LSB_REG);
		outb(devpriv->mode_reg_int | PCL812_CTRL_DISABLE_TRIG,
		     dev->iobase + PCL812_CTRL_REG);
		pcl812_ai_clear_eoc(dev);
		break;
	case boardPCL813B:
	case boardPCL813:
	case boardISO813:
	case boardACL8113:
		udelay(5);
		break;
	}
	}
	udelay(5);
}
}


static void pcl812_set_ai_range_table(struct comedi_device *dev,
static void pcl812_set_ai_range_table(struct comedi_device *dev,