Commit 61b3980f authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl816: reduce indent level in pcl816_ai_cancel()

If an async command is not running the (*cancel) function doesn't do
anything. Exit the function early if this is the case.

This allows reducing the indent level in the rest of the function.
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 a8f461c2
......@@ -549,37 +549,38 @@ static int pcl816_ai_cancel(struct comedi_device *dev,
{
struct pcl816_private *devpriv = dev->private;
if (devpriv->ai_cmd_running) {
switch (devpriv->int816_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
disable_dma(devpriv->dma);
outb(inb(dev->iobase + PCL816_CONTROL) & 0x73,
dev->iobase + PCL816_CONTROL); /* Stop A/D */
udelay(1);
outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */
/* Stop pacer */
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
2, I8254_MODE0 | I8254_BINARY);
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
1, I8254_MODE0 | I8254_BINARY);
outb(0, dev->iobase + PCL816_AD_LO);
pcl816_ai_get_sample(dev, s);
/* clear INT request */
outb(0, dev->iobase + PCL816_CLRINT);
if (!devpriv->ai_cmd_running)
return 0;
/* Stop A/D */
outb(0, dev->iobase + PCL816_CONTROL);
devpriv->ai_cmd_running = 0;
devpriv->irq_was_now_closed = 1;
devpriv->int816_mode = 0;
/* s->busy = 0; */
break;
}
switch (devpriv->int816_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
disable_dma(devpriv->dma);
outb(inb(dev->iobase + PCL816_CONTROL) & 0x73,
dev->iobase + PCL816_CONTROL); /* Stop A/D */
udelay(1);
outb(0, dev->iobase + PCL816_CONTROL); /* Stop A/D */
/* Stop pacer */
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
2, I8254_MODE0 | I8254_BINARY);
i8254_set_mode(dev->iobase + PCL816_TIMER_BASE, 0,
1, I8254_MODE0 | I8254_BINARY);
outb(0, dev->iobase + PCL816_AD_LO);
pcl816_ai_get_sample(dev, s);
/* clear INT request */
outb(0, dev->iobase + PCL816_CLRINT);
/* Stop A/D */
outb(0, dev->iobase + PCL816_CONTROL);
devpriv->ai_cmd_running = 0;
devpriv->irq_was_now_closed = 1;
devpriv->int816_mode = 0;
break;
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment