staging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 5 Nov 2014 17:20:55 +0000 (10:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Nov 2014 22:59:46 +0000 (14:59 -0800)
Remove the private data member 'ntrig' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/pcl711.c

index 48a79b8221fce5b6de54c8ed3376069723fefa5f..93fa4b8ddf15436281944b1840008f8fdd2e7dd4 100644 (file)
@@ -156,7 +156,6 @@ static const struct pcl711_board boardtypes[] = {
 };
 
 struct pcl711_private {
-       unsigned int ntrig;
        unsigned int divisor1;
        unsigned int divisor2;
 };
@@ -199,7 +198,6 @@ static int pcl711_ai_cancel(struct comedi_device *dev,
 static irqreturn_t pcl711_interrupt(int irq, void *d)
 {
        struct comedi_device *dev = d;
-       struct pcl711_private *devpriv = dev->private;
        struct comedi_subdevice *s = dev->read_subdev;
        struct comedi_cmd *cmd = &s->async->cmd;
        unsigned int data;
@@ -213,10 +211,12 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
 
        outb(PCL711_INT_STAT_CLR, dev->iobase + PCL711_INT_STAT_REG);
 
-       if (comedi_buf_write_samples(s, &data, 1)) {
-               if (cmd->stop_src == TRIG_COUNT && !(--devpriv->ntrig))
-                       s->async->events |= COMEDI_CB_EOA;
-       }
+       comedi_buf_write_samples(s, &data, 1);
+
+       if (cmd->stop_src == TRIG_COUNT &&
+           s->async->scans_done >= cmd->stop_arg)
+               s->async->events |= COMEDI_CB_EOA;
+
        comedi_handle_events(dev, s);
 
        return IRQ_HANDLED;
@@ -369,14 +369,10 @@ static void pcl711_ai_load_counters(struct comedi_device *dev)
 
 static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
 {
-       struct pcl711_private *devpriv = dev->private;
        struct comedi_cmd *cmd = &s->async->cmd;
 
        pcl711_set_changain(dev, s, cmd->chanlist[0]);
 
-       if (cmd->stop_src == TRIG_COUNT)
-               devpriv->ntrig = cmd->stop_arg;
-
        if (cmd->scan_begin_src == TRIG_TIMER) {
                pcl711_ai_load_counters(dev);
                outb(PCL711_INT_STAT_CLR, dev->iobase + PCL711_INT_STAT_REG);