include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / comedi / drivers / pcl818.c
index d0481013a837bb5fcc30da7a6cb8aedd70b85c80..9d6aa393ef13b83785efff2bee825662714c64fd 100644 (file)
@@ -102,6 +102,7 @@ A word or two about DMA. Driver support DMA operations at two ways:
 
 #include <linux/ioport.h>
 #include <linux/mc146818rtc.h>
+#include <linux/gfp.h>
 #include <linux/delay.h>
 #include <asm/dma.h>
 
@@ -557,8 +558,14 @@ conv_finish:
                comedi_event(dev, s);
                return IRQ_HANDLED;
        }
-       if (s->async->cur_chan == 0) {
+       devpriv->act_chanlist_pos++;
+       if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
+               devpriv->act_chanlist_pos = 0;
+       }
+       s->async->cur_chan++;
+       if (s->async->cur_chan >= devpriv->ai_n_chan) {
                /*  printk("E"); */
+               s->async->cur_chan = 0;
                devpriv->ai_act_scan--;
        }
 
@@ -627,9 +634,13 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
 
                devpriv->act_chanlist_pos++;
                if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
-                       devpriv->ai_act_scan--;
                        devpriv->act_chanlist_pos = 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->neverending_ai)
                        if (devpriv->ai_act_scan == 0) {        /* all data sampled */
@@ -717,7 +728,14 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma_rtc(int irq, void *d)
                        comedi_buf_put(s->async, dmabuf[bufptr++] >> 4);        /*  get one sample */
                        bufptr &= (devpriv->dmasamplsize - 1);
 
-                       if (s->async->cur_chan == 0) {
+                       devpriv->act_chanlist_pos++;
+                       if (devpriv->act_chanlist_pos >=
+                                       devpriv->act_chanlist_len) {
+                               devpriv->act_chanlist_pos = 0;
+                       }
+                       s->async->cur_chan++;
+                       if (s->async->cur_chan >= devpriv->ai_n_chan) {
+                               s->async->cur_chan = 0;
                                devpriv->ai_act_scan--;
                        }
 
@@ -796,7 +814,13 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
 
                comedi_buf_put(s->async, (lo >> 4) | (inb(dev->iobase + PCL818_FI_DATAHI) << 4));       /*  get one sample */
 
-               if (s->async->cur_chan == 0) {
+               devpriv->act_chanlist_pos++;
+               if (devpriv->act_chanlist_pos >= devpriv->act_chanlist_len) {
+                       devpriv->act_chanlist_pos = 0;
+               }
+               s->async->cur_chan++;
+               if (s->async->cur_chan >= devpriv->ai_n_chan) {
+                       s->async->cur_chan = 0;
                        devpriv->ai_act_scan--;
                }
 
@@ -1369,14 +1393,6 @@ static int ai_cmdtest(struct comedi_device *dev, struct comedi_subdevice *s,
                }
        }
 
-       if (!cmd->chanlist_len) {
-               cmd->chanlist_len = 1;
-               err++;
-       }
-       if (cmd->chanlist_len > s->n_chan) {
-               cmd->chanlist_len = s->n_chan;
-               err++;
-       }
        if (cmd->scan_end_arg != cmd->chanlist_len) {
                cmd->scan_end_arg = cmd->chanlist_len;
                err++;