Use cfc_handler_events() to automatically (*cancel) the async command for
an end-of-acquisition or if an error/overflow occurs.

Also, cfc_handle_events() does nothing if no events are set so the local
variable 'do_event' can be removed.

Signed-off-by: H Hartley Sweeten <hswee...@visionengravers.com>
Cc: Ian Abbott <abbo...@mev.co.uk>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/staging/comedi/drivers/addi_apci_2032.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c 
b/drivers/staging/comedi/drivers/addi_apci_2032.c
index aea3da3..f020453 100644
--- a/drivers/staging/comedi/drivers/addi_apci_2032.c
+++ b/drivers/staging/comedi/drivers/addi_apci_2032.c
@@ -178,7 +178,6 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
        struct comedi_cmd *cmd = &s->async->cmd;
        struct apci2032_int_private *subpriv;
        unsigned int val;
-       bool do_event = false;
 
        if (!dev->attached)
                return IRQ_NONE;
@@ -220,19 +219,16 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
                                if (subpriv->stop_count == 0) {
                                        /* end of acquisition */
                                        s->async->events |= COMEDI_CB_EOA;
-                                       apci2032_int_stop(dev, s);
                                }
                        }
                } else {
-                       apci2032_int_stop(dev, s);
                        s->async->events |= COMEDI_CB_OVERFLOW;
                }
-               do_event = true;
        }
 
        spin_unlock(&subpriv->spinlock);
-       if (do_event)
-               comedi_event(dev, s);
+
+       cfc_handle_events(dev, s);
 
        return IRQ_HANDLED;
 }
-- 
2.0.3

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to