Commit 2850b1c7 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl818: reduce indent level in pcl818_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.

Also, move the setting of the 'irq_was_now_closed' to the only place
wher it actually gets left set to 1 and remove the goto.
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 61b3980f
......@@ -1057,42 +1057,45 @@ static int pcl818_ai_cancel(struct comedi_device *dev,
struct pcl818_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
if (devpriv->ai_cmd_running) {
devpriv->irq_was_now_closed = 1;
switch (devpriv->ai_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
if (cmd->stop_src == TRIG_NONE ||
(cmd->stop_src == TRIG_COUNT && devpriv->ai_act_scan > 0)) {
/* wait for running dma transfer to end, do cleanup in interrupt */
goto end;
}
disable_dma(devpriv->dma);
case INT_TYPE_AI1_INT:
case INT_TYPE_AI3_INT:
case INT_TYPE_AI1_FIFO:
case INT_TYPE_AI3_FIFO:
outb(inb(dev->iobase + PCL818_CONTROL) & 0x73, dev->iobase + PCL818_CONTROL); /* Stop A/D */
udelay(1);
pcl818_start_pacer(dev, false);
outb(0, dev->iobase + PCL818_AD_LO);
pcl818_ai_get_sample(dev, s, NULL);
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
outb(0, dev->iobase + PCL818_CONTROL); /* Stop A/D */
if (devpriv->usefifo) { /* FIFO shutdown */
outb(0, dev->iobase + PCL818_FI_INTCLR);
outb(0, dev->iobase + PCL818_FI_FLUSH);
outb(0, dev->iobase + PCL818_FI_ENABLE);
}
devpriv->ai_cmd_running = 0;
devpriv->ai_mode = 0;
devpriv->irq_was_now_closed = 0;
break;
if (!devpriv->ai_cmd_running)
return 0;
switch (devpriv->ai_mode) {
case INT_TYPE_AI1_DMA:
case INT_TYPE_AI3_DMA:
if (cmd->stop_src == TRIG_NONE ||
(cmd->stop_src == TRIG_COUNT && devpriv->ai_act_scan > 0)) {
/*
* Wait for running dma transfer to end,
* do cleanup in interrupt.
*/
devpriv->irq_was_now_closed = 1;
return 0;
}
disable_dma(devpriv->dma);
case INT_TYPE_AI1_INT:
case INT_TYPE_AI3_INT:
case INT_TYPE_AI1_FIFO:
case INT_TYPE_AI3_FIFO:
outb(inb(dev->iobase + PCL818_CONTROL) & 0x73,
dev->iobase + PCL818_CONTROL); /* Stop A/D */
udelay(1);
pcl818_start_pacer(dev, false);
outb(0, dev->iobase + PCL818_AD_LO);
pcl818_ai_get_sample(dev, s, NULL);
outb(0, dev->iobase + PCL818_CLRINT); /* clear INT request */
outb(0, dev->iobase + PCL818_CONTROL); /* Stop A/D */
if (devpriv->usefifo) { /* FIFO shutdown */
outb(0, dev->iobase + PCL818_FI_INTCLR);
outb(0, dev->iobase + PCL818_FI_FLUSH);
outb(0, dev->iobase + PCL818_FI_ENABLE);
}
devpriv->ai_cmd_running = 0;
devpriv->ai_mode = 0;
devpriv->irq_was_now_closed = 0;
break;
}
end:
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