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

Update the Kconfig so that COMEDI_PCL818 selects COMEDI_FC.

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/Kconfig          | 1 +
 drivers/staging/comedi/drivers/pcl818.c | 7 +------
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index df7010b..2fb0cc0 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -199,6 +199,7 @@ config COMEDI_PCL816
 config COMEDI_PCL818
        tristate "Advantech PCL-718 and PCL-818 ISA card support"
        depends on VIRT_TO_BUS && ISA_DMA_API
+       select COMEDI_FC
        ---help---
          Enable support for Advantech PCL-818 ISA cards
          PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718
diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index d4d5c38..6463476 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -510,7 +510,6 @@ static bool pcl818_ai_dropout(struct comedi_device *dev,
                        (devpriv->dma) ? "DMA" :
                        (devpriv->usefifo) ? "FIFO" : "IRQ",
                        chan, expected_chan);
-               s->cancel(dev, s);
                s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
                return true;
        }
@@ -538,7 +537,6 @@ static bool pcl818_ai_next_chan(struct comedi_device *dev,
 
        if (cmd->stop_src == TRIG_COUNT && devpriv->ai_act_scan == 0) {
                /* all data sampled */
-               s->cancel(dev, s);
                s->async->events |= COMEDI_CB_EOA;
                return false;
        }
@@ -554,7 +552,6 @@ static void pcl818_handle_eoc(struct comedi_device *dev,
 
        if (pcl818_ai_eoc(dev, s, NULL, 0)) {
                comedi_error(dev, "A/D mode1/3 IRQ without DRDY!");
-               s->cancel(dev, s);
                s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
                return;
        }
@@ -612,14 +609,12 @@ static void pcl818_handle_fifo(struct comedi_device *dev,
 
        if (status & 4) {
                comedi_error(dev, "A/D mode1/3 FIFO overflow!");
-               s->cancel(dev, s);
                s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
                return;
        }
 
        if (status & 1) {
                comedi_error(dev, "A/D mode1/3 FIFO interrupt without data!");
-               s->cancel(dev, s);
                s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
                return;
        }
@@ -674,7 +669,7 @@ static irqreturn_t pcl818_interrupt(int irq, void *d)
 
        pcl818_ai_clear_eoc(dev);
 
-       comedi_event(dev, s);
+       cfc_handle_events(dev, s);
        return IRQ_HANDLED;
 }
 
-- 
1.8.5.2

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

Reply via email to