Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

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/pcmmio.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmmio.c 
b/drivers/staging/comedi/drivers/pcmmio.c
index df47967..985fabd 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -190,7 +190,6 @@ struct pcmmio_private {
        spinlock_t pagelock;    /* protects the page registers */
        spinlock_t spinlock;    /* protects the member variables */
        unsigned int enabled_mask;
-       unsigned int stop_count;
        unsigned int active:1;
 };
 
@@ -358,12 +357,9 @@ static void pcmmio_handle_dio_intr(struct comedi_device 
*dev,
 
        comedi_buf_write_samples(s, &val, 1);
 
-       /* Check for end of acquisition. */
-       if (cmd->stop_src == TRIG_COUNT && devpriv->stop_count > 0) {
-               devpriv->stop_count--;
-               if (devpriv->stop_count == 0)
-                       s->async->events |= COMEDI_CB_EOA;
-       }
+       if (cmd->stop_src == TRIG_COUNT &&
+           s->async->scans_done >= cmd->stop_arg)
+               s->async->events |= COMEDI_CB_EOA;
 
 done:
        spin_unlock_irqrestore(&devpriv->spinlock, flags);
@@ -468,8 +464,6 @@ static int pcmmio_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
        spin_lock_irqsave(&devpriv->spinlock, flags);
        devpriv->active = 1;
 
-       devpriv->stop_count = cmd->stop_arg;
-
        /* Set up start of acquisition. */
        if (cmd->start_src == TRIG_INT)
                s->async->inttrig = pcmmio_inttrig_start_intr;
-- 
2.0.3

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

Reply via email to