]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: adl_pci9118: simplify interrupt_pci9118_ai_dma() a bit
authorIan Abbott <abbotti@mev.co.uk>
Thu, 27 Nov 2014 11:37:17 +0000 (11:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2014 00:31:20 +0000 (16:31 -0800)
Eliminate the `next_dma_buf` variable in `interrupt_pci9118_ai_dma()`.
It holds the next value of `devpriv->dma_actbuf` when double buffering
is used, but we can just set that to the next value directly at the
point where the buffers are switched as the old value is not used
anywhere else.

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

index 5e0ff9db6a47cac92489e1a1fa4262de4f8f3f31..aecfae8916288d8acb96fbfeb842e99a5188b9ce 100644 (file)
@@ -608,16 +608,15 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
        struct comedi_cmd *cmd = &s->async->cmd;
        struct pci9118_dmabuf *dmabuf = &devpriv->dmabuf[devpriv->dma_actbuf];
        unsigned int nsamples = comedi_bytes_to_samples(s, dmabuf->use_size);
-       unsigned int next_dma_buf;
 
-       if (devpriv->dma_doublebuf) {   /*
-                                        * switch DMA buffers if is used
-                                        * double buffering
-                                        */
-               next_dma_buf = 1 - devpriv->dma_actbuf;
-               pci9118_amcc_setup_dma(dev, next_dma_buf);
-               if (devpriv->ai_do == 4)
-                       interrupt_pci9118_ai_mode4_switch(dev, next_dma_buf);
+       /* switch DMA buffers and restart DMA if double buffering */
+       if (devpriv->dma_doublebuf) {
+               devpriv->dma_actbuf = 1 - devpriv->dma_actbuf;
+               pci9118_amcc_setup_dma(dev, devpriv->dma_actbuf);
+               if (devpriv->ai_do == 4) {
+                       interrupt_pci9118_ai_mode4_switch(dev,
+                                                         devpriv->dma_actbuf);
+               }
        }
 
        if (nsamples) {
@@ -631,11 +630,8 @@ static void interrupt_pci9118_ai_dma(struct comedi_device *dev,
                        s->async->events |= COMEDI_CB_EOA;
        }
 
-       if (devpriv->dma_doublebuf) {
-               /* switch dma buffers */
-               devpriv->dma_actbuf = 1 - devpriv->dma_actbuf;
-       } else {
-               /* restart DMA if is not used double buffering */
+       /* restart DMA if not double buffering */
+       if (!devpriv->dma_doublebuf) {
                pci9118_amcc_setup_dma(dev, 0);
                if (devpriv->ai_do == 4)
                        interrupt_pci9118_ai_mode4_switch(dev, 0);