From: H Hartley Sweeten Date: Tue, 4 Mar 2014 18:29:42 +0000 (-0700) Subject: staging: comedi: pcl816: reduce indent level in pcl816_ai_cancel() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=61b3980f1f7471b1d74a8571a29710bf6937f702;p=linux-beck.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 36599861c78b..d6dae5466023 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -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; }