Make sure interrupts are disabled and the event flags are cleared when
the analog input async command is canceled.

Remove the unnecessary calls to stop any running conversions in the
(*insn_read) and (*do_cmd) functions. The comedi core will only call
these functions if the subdevice is not busy (it has already been
canceled).

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/quatech_daqp_cs.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c 
b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index dbb8ffc..f337833 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -152,19 +152,21 @@ static const struct comedi_lrange range_daqp_ai = {
        }
 };
 
-/* Cancel a running acquisition */
-
-static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice 
*s)
+static int daqp_ai_cancel(struct comedi_device *dev,
+                         struct comedi_subdevice *s)
 {
        struct daqp_private *devpriv = dev->private;
 
        if (devpriv->stop)
                return -EIO;
 
+       /*
+        * Stop any conversions, disable interrupts, and clear
+        * the status event flags.
+        */
        outb(DAQP_COMMAND_STOP, dev->iobase + DAQP_COMMAND);
-
-       /* flush any linguring data in FIFO - superfluous here */
-       /* outb(DAQP_COMMAND_RSTF, dev->iobase+DAQP_COMMAND); */
+       outb(0, dev->iobase + DAQP_CONTROL);
+       inb(dev->iobase + DAQP_STATUS);
 
        devpriv->interrupt_mode = semaphore;
 
@@ -282,9 +284,6 @@ static int daqp_ai_insn_read(struct comedi_device *dev,
        if (devpriv->stop)
                return -EIO;
 
-       /* Stop any running conversion */
-       daqp_ai_cancel(dev, s);
-
        outb(0, dev->iobase + DAQP_AUX);
 
        /* Program one scan list entry */
@@ -443,9 +442,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
        if (devpriv->stop)
                return -EIO;
 
-       /* Stop any running conversion */
-       daqp_ai_cancel(dev, s);
-
        outb(0, dev->iobase + DAQP_AUX);
 
        /* Program pacer clock */
-- 
2.5.1

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

Reply via email to