Staging: comedi: pcl812: Correct AI scan counting
authorIan Abbott <abbotti@mev.co.uk>
Wed, 20 Jan 2010 13:04:44 +0000 (13:04 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:46 +0000 (16:42 -0800)
The AI scan counter should be updated after every completed scan,
not after every channel.  Keep track of current channel.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/comedi/drivers/pcl812.c

index 0a5bc3d6da8c30549a8be2d6865574ee07be9686..aa912735ddba711bf89bebcd4fb205e5e0c76037 100644 (file)
@@ -995,7 +995,9 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
 
        outb(0, dev->iobase + PCL812_CLRINT);   /* clear INT request */
 
-       if (s->async->cur_chan == 0) {  /* one scan done */
+       s->async->cur_chan++;
+       if (s->async->cur_chan >= devpriv->ai_n_chan) { /* one scan done */
+               s->async->cur_chan = 0;
                devpriv->ai_act_scan++;
                if (!(devpriv->ai_neverending))
                        if (devpriv->ai_act_scan >= devpriv->ai_scans) {        /* all data sampled */
@@ -1021,7 +1023,9 @@ static void transfer_from_dma_buf(struct comedi_device *dev,
        for (i = len; i; i--) {
                comedi_buf_put(s->async, ptr[bufptr++]);        /*  get one sample */
 
-               if (s->async->cur_chan == 0) {
+               s->async->cur_chan++;
+               if (s->async->cur_chan >= devpriv->ai_n_chan) {
+                       s->async->cur_chan = 0;
                        devpriv->ai_act_scan++;
                        if (!devpriv->ai_neverending)
                                if (devpriv->ai_act_scan >= devpriv->ai_scans) {        /* all data sampled */