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

staging: comedi: adl_pci9118: use cfc_handle_events()

Use the comedi_fc helper function to automatically call the subdevice
(*cancel) function when needed and call comedi_event().

In the Kconfig, COMEDI_ADL_PCI9118 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 12d6dda6
...@@ -919,8 +919,7 @@ static char pci9118_decode_error_status(struct comedi_device *dev, ...@@ -919,8 +919,7 @@ static char pci9118_decode_error_status(struct comedi_device *dev,
} }
if (m & devpriv->ai_maskharderr) { if (m & devpriv->ai_maskharderr) {
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
pci9118_ai_cancel(dev, s); cfc_handle_events(dev, s);
comedi_event(dev, s);
return 1; return 1;
} }
...@@ -973,8 +972,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, ...@@ -973,8 +972,7 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
sampl & 0x000f, sampl & 0x000f,
devpriv->chanlist[s->async->cur_chan]); devpriv->chanlist[s->async->cur_chan]);
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
pci9118_ai_cancel(dev, s); cfc_handle_events(dev, s);
comedi_event(dev, s);
return; return;
} }
} }
...@@ -985,16 +983,14 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev, ...@@ -985,16 +983,14 @@ static void interrupt_pci9118_ai_onesample(struct comedi_device *dev,
/* one scan done */ /* one scan done */
s->async->cur_chan %= devpriv->ai_n_scanlen; s->async->cur_chan %= devpriv->ai_n_scanlen;
devpriv->ai_act_scan++; devpriv->ai_act_scan++;
if (!(devpriv->ai_neverending)) if (!devpriv->ai_neverending) {
if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled? */
/* all data sampled */ if (devpriv->ai_act_scan >= devpriv->ai_scans)
pci9118_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
} }
} }
if (s->async->events) cfc_handle_events(dev, s);
comedi_event(dev, s);
} }
static void interrupt_pci9118_ai_dma(struct comedi_device *dev, static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
...@@ -1009,16 +1005,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -1009,16 +1005,14 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
if (int_amcc & MASTER_ABORT_INT) { if (int_amcc & MASTER_ABORT_INT) {
comedi_error(dev, "AMCC IRQ - MASTER DMA ABORT!"); comedi_error(dev, "AMCC IRQ - MASTER DMA ABORT!");
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
pci9118_ai_cancel(dev, s); cfc_handle_events(dev, s);
comedi_event(dev, s);
return; return;
} }
if (int_amcc & TARGET_ABORT_INT) { if (int_amcc & TARGET_ABORT_INT) {
comedi_error(dev, "AMCC IRQ - TARGET DMA ABORT!"); comedi_error(dev, "AMCC IRQ - TARGET DMA ABORT!");
s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA; s->async->events |= COMEDI_CB_ERROR | COMEDI_CB_EOA;
pci9118_ai_cancel(dev, s); cfc_handle_events(dev, s);
comedi_event(dev, s);
return; return;
} }
if (int_adstat & devpriv->ai_maskerr) if (int_adstat & devpriv->ai_maskerr)
...@@ -1056,10 +1050,9 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -1056,10 +1050,9 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
m = m - sampls; /* m= how many samples was transferred */ m = m - sampls; /* m= how many samples was transferred */
} }
if (!devpriv->ai_neverending) if (!devpriv->ai_neverending) {
if (devpriv->ai_act_scan >= devpriv->ai_scans) { /* all data sampled? */
/* all data sampled */ if (devpriv->ai_act_scan >= devpriv->ai_scans)
pci9118_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
} }
...@@ -1074,7 +1067,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev, ...@@ -1074,7 +1067,7 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
interrupt_pci9118_ai_mode4_switch(dev); interrupt_pci9118_ai_mode4_switch(dev);
} }
comedi_event(dev, s); cfc_handle_events(dev, s);
} }
static irqreturn_t interrupt_pci9118(int irq, void *d) static irqreturn_t interrupt_pci9118(int irq, void *d)
......
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