Commit 7ff4b584 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_2032: use comedi_handle_events()

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

Also, comedi_handle_events() does nothing if no events are set so the
local variable 'do_event' can be removed.
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 215ecf8a
...@@ -178,7 +178,6 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) ...@@ -178,7 +178,6 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
struct comedi_cmd *cmd = &s->async->cmd; struct comedi_cmd *cmd = &s->async->cmd;
struct apci2032_int_private *subpriv; struct apci2032_int_private *subpriv;
unsigned int val; unsigned int val;
bool do_event = false;
if (!dev->attached) if (!dev->attached)
return IRQ_NONE; return IRQ_NONE;
...@@ -220,19 +219,16 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) ...@@ -220,19 +219,16 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
if (subpriv->stop_count == 0) { if (subpriv->stop_count == 0) {
/* end of acquisition */ /* end of acquisition */
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
apci2032_int_stop(dev, s);
} }
} }
} else { } else {
apci2032_int_stop(dev, s);
s->async->events |= COMEDI_CB_OVERFLOW; s->async->events |= COMEDI_CB_OVERFLOW;
} }
do_event = true;
} }
spin_unlock(&subpriv->spinlock); spin_unlock(&subpriv->spinlock);
if (do_event)
comedi_event(dev, s); comedi_handle_events(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
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