staging: comedi: ni_labpc: use cfc_handle_events()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Sat, 8 Mar 2014 00:31:43 +0000 (17:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Mar 2014 20:55:56 +0000 (13:55 -0700)
Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

Also, remove the clearing of the events, comedi_event() does that.

In the Kconfig, COMEDI_NI_LABPC already selects COMEDI_FC.

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/ni_labpc.c

index 037b46eb949fd76937505fa3971f200a937720e4..f4216e825f03a8e63e2c2a0ec743b148337e62f1 100644 (file)
@@ -947,7 +947,6 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
 
        async = s->async;
        cmd = &async->cmd;
-       async->events = 0;
 
        /* read board status */
        devpriv->stat1 = devpriv->read_byte(dev->iobase + STAT1_REG);
@@ -965,7 +964,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
                /* clear error interrupt */
                devpriv->write_byte(0x1, dev->iobase + ADC_FIFO_CLEAR_REG);
                async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
-               comedi_event(dev, s);
+               cfc_handle_events(dev, s);
                comedi_error(dev, "overrun");
                return IRQ_HANDLED;
        }
@@ -985,7 +984,7 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
                /*  clear error interrupt */
                devpriv->write_byte(0x1, dev->iobase + ADC_FIFO_CLEAR_REG);
                async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
-               comedi_event(dev, s);
+               cfc_handle_events(dev, s);
                comedi_error(dev, "overflow");
                return IRQ_HANDLED;
        }
@@ -993,20 +992,17 @@ static irqreturn_t labpc_interrupt(int irq, void *d)
        if (cmd->stop_src == TRIG_EXT) {
                if (devpriv->stat2 & STAT2_OUTA1) {
                        labpc_drain_dregs(dev);
-                       labpc_cancel(dev, s);
                        async->events |= COMEDI_CB_EOA;
                }
        }
 
        /* TRIG_COUNT end of acquisition */
        if (cmd->stop_src == TRIG_COUNT) {
-               if (devpriv->count == 0) {
-                       labpc_cancel(dev, s);
+               if (devpriv->count == 0)
                        async->events |= COMEDI_CB_EOA;
-               }
        }
 
-       comedi_event(dev, s);
+       cfc_handle_events(dev, s);
        return IRQ_HANDLED;
 }