staging: comedi: adl_pci9118: remove 'ai_data_len' from private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 5 May 2014 16:35:31 +0000 (09:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:18:53 +0000 (21:18 +0900)
This member of the private data is just a copy of the s->async->prealloc_bufsz.
Use that instead.

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/adl_pci9118.c

index cc56da4fe857613755baadb427bef920b8ec00e4..94ede354b4fab58db91adbda35d954b67f5efda8 100644 (file)
@@ -351,7 +351,6 @@ struct pci9118_private {
                                                 * divisors for start of measure
                                                 * on external start
                                                 */
-       unsigned int ai_data_len;
        unsigned short ao_data[2];              /* data output buffer */
        unsigned int ai_scans;                  /* number of scans to do */
        char dma_doublebuf;                     /* we can use double buffering */
@@ -1035,10 +1034,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
        }
 
        if (samplesinbuf) {
-               m = devpriv->ai_data_len >> 1;  /*
-                                                * how many samples is to
-                                                * end of buffer
-                                                */
+               /* how many samples is to end of buffer */
+               m = s->async->prealloc_bufsz >> 1;
                sampls = m;
                move_block_from_dma(dev, s,
                                    devpriv->dmabuf_virt[devpriv->dma_actbuf],
@@ -1335,7 +1332,8 @@ static int pci9118_ai_cmdtest(struct comedi_device *dev,
        return 0;
 }
 
-static int Compute_and_setup_dma(struct comedi_device *dev)
+static int Compute_and_setup_dma(struct comedi_device *dev,
+                                struct comedi_subdevice *s)
 {
        struct pci9118_private *devpriv = dev->private;
        unsigned int dmalen0, dmalen1, i;
@@ -1343,15 +1341,13 @@ static int Compute_and_setup_dma(struct comedi_device *dev)
        dmalen0 = devpriv->dmabuf_size[0];
        dmalen1 = devpriv->dmabuf_size[1];
        /* isn't output buff smaller that our DMA buff? */
-       if (dmalen0 > (devpriv->ai_data_len)) {
-               dmalen0 = devpriv->ai_data_len & ~3L;   /*
-                                                        * align to 32bit down
-                                                        */
+       if (dmalen0 > s->async->prealloc_bufsz) {
+               /* align to 32bit down */
+               dmalen0 = s->async->prealloc_bufsz & ~3L;
        }
-       if (dmalen1 > (devpriv->ai_data_len)) {
-               dmalen1 = devpriv->ai_data_len & ~3L;   /*
-                                                        * align to 32bit down
-                                                        */
+       if (dmalen1 > s->async->prealloc_bufsz) {
+               /* align to 32bit down */
+               dmalen1 = s->async->prealloc_bufsz & ~3L;
        }
 
        /* we want wake up every scan? */
@@ -1540,7 +1536,7 @@ static int pci9118_ai_docmd_dma(struct comedi_device *dev,
 {
        struct pci9118_private *devpriv = dev->private;
 
-       Compute_and_setup_dma(dev);
+       Compute_and_setup_dma(dev, s);
 
        switch (devpriv->ai_do) {
        case 1:
@@ -1616,7 +1612,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        devpriv->ai12_startstop = 0;
        devpriv->ai_flags = cmd->flags;
        devpriv->ai_n_scanlen = cmd->scan_end_arg;
-       devpriv->ai_data_len = s->async->prealloc_bufsz;
        devpriv->ai_timer1 = 0;
        devpriv->ai_timer2 = 0;
        devpriv->ai_add_front = 0;