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

staging: comedi: ni_at_a2150: use cfc_handle_events()

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_AT_A2150 already selects COMEDI_FC.
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 f21c74fa
...@@ -184,7 +184,6 @@ static irqreturn_t a2150_interrupt(int irq, void *d) ...@@ -184,7 +184,6 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
} }
/* initialize async here to make sure s is not NULL */ /* initialize async here to make sure s is not NULL */
async = s->async; async = s->async;
async->events = 0;
cmd = &async->cmd; cmd = &async->cmd;
status = inw(dev->iobase + STATUS_REG); status = inw(dev->iobase + STATUS_REG);
...@@ -196,15 +195,14 @@ static irqreturn_t a2150_interrupt(int irq, void *d) ...@@ -196,15 +195,14 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
if (status & OVFL_BIT) { if (status & OVFL_BIT) {
comedi_error(dev, "fifo overflow"); comedi_error(dev, "fifo overflow");
a2150_cancel(dev, s);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
cfc_handle_events(dev, s);
} }
if ((status & DMA_TC_BIT) == 0) { if ((status & DMA_TC_BIT) == 0) {
comedi_error(dev, "caught non-dma interrupt? Aborting."); comedi_error(dev, "caught non-dma interrupt? Aborting.");
a2150_cancel(dev, s);
async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
comedi_event(dev, s); cfc_handle_events(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -249,7 +247,6 @@ static irqreturn_t a2150_interrupt(int irq, void *d) ...@@ -249,7 +247,6 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
cfc_write_to_buffer(s, dpnt); cfc_write_to_buffer(s, dpnt);
if (cmd->stop_src == TRIG_COUNT) { if (cmd->stop_src == TRIG_COUNT) {
if (--devpriv->count == 0) { /* end of acquisition */ if (--devpriv->count == 0) { /* end of acquisition */
a2150_cancel(dev, s);
async->events |= COMEDI_CB_EOA; async->events |= COMEDI_CB_EOA;
break; break;
} }
...@@ -265,7 +262,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d) ...@@ -265,7 +262,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
async->events |= COMEDI_CB_BLOCK; async->events |= COMEDI_CB_BLOCK;
comedi_event(dev, s); cfc_handle_events(dev, s);
/* clear interrupt */ /* clear interrupt */
outw(0x00, dev->iobase + DMA_TC_CLEAR_REG); outw(0x00, dev->iobase + DMA_TC_CLEAR_REG);
......
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