staging: comedi: adl_pci9118: do cfc_handle_events() at end of interrupt
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Sep 2014 20:05:33 +0000 (13:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Sep 2014 21:34:24 +0000 (14:34 -0700)
Each of the error detections currently do a cfc_handle_events() and exits
the interrupt handler if the error is detected. The DMA and non-DMA handlers
also to a cfc_handle_events().

For aesthetics, use goto to exit the interrupt handler if an error is detected
and move the cfc_handle_events() call to the end of the interrupt.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/adl_pci9118.c

index 48d09de6ffc96384ed33cdd9c9d7145ac77ffc5c..a5a59ee827e9b56ffc91db7fb04e18543bc1b1ec 100644 (file)
@@ -707,7 +707,6 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
                                 sampl & 0x000f,
                                 devpriv->chanlist[s->async->cur_chan]);
                        s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
-                       cfc_handle_events(dev, s);
                        return;
                }
        }
@@ -724,8 +723,6 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
                                s->async->events |= COMEDI_CB_EOA;
                }
        }
-
-       cfc_handle_events(dev, s);
 }
 
 static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
@@ -775,8 +772,6 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
                if (devpriv->ai_do == 4)
                        interrupt_pci9118_ai_mode4_switch(dev);
        }
-
-       cfc_handle_events(dev, s);
 }
 
 static irqreturn_t pci9118_interrupt(int irq, void *d)
@@ -802,15 +797,13 @@ static irqreturn_t pci9118_interrupt(int irq, void *d)
        if (intcsr & MASTER_ABORT_INT) {
                dev_err(dev->class_dev, "AMCC IRQ - MASTER DMA ABORT!\n");
                s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
 
        if (intcsr & TARGET_ABORT_INT) {
                dev_err(dev->class_dev, "AMCC IRQ - TARGET DMA ABORT!\n");
                s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
 
        adstat = inl(dev->iobase + PCI9118_AI_STATUS_REG);
@@ -818,27 +811,23 @@ static irqreturn_t pci9118_interrupt(int irq, void *d)
                dev_err(dev->class_dev,
                        "A/D FIFO Full status (Fatal Error!)\n");
                s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
        if (adstat & PCI9118_AI_STATUS_BOVER) {
                dev_err(dev->class_dev,
                        "A/D Burst Mode Overrun Status (Fatal Error!)\n");
                s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
        if (adstat & PCI9118_AI_STATUS_ADOS) {
                dev_err(dev->class_dev, "A/D Over Speed Status (Warning!)\n");
                s->async->events |= COMEDI_CB_ERROR;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
        if (adstat & PCI9118_AI_STATUS_ADOR) {
                dev_err(dev->class_dev, "A/D Overrun Status (Fatal Error!)\n");
                s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_OVERFLOW;
-               cfc_handle_events(dev, s);
-               return IRQ_HANDLED;
+               goto interrupt_exit;
        }
 
        if (!devpriv->ai_do)
@@ -874,6 +863,8 @@ static irqreturn_t pci9118_interrupt(int irq, void *d)
        else
                interrupt_pci9118_ai_onesample(dev, s);
 
+interrupt_exit:
+       cfc_handle_events(dev, s);
        return IRQ_HANDLED;
 }