staging: comedi: pcl818: absorb pcl818_ai_mode13dma_int()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Mar 2014 18:30:21 +0000 (11:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Mar 2014 01:06:18 +0000 (17:06 -0800)
Absorb this function into pcl818_ai_cmd_mode() and simplify the code.

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

index d07d3606a02de2876b017b6e427f0e24c652d7c4..c4f9d54ca0a644ff99e3eec7469d0a3469e434a8 100644 (file)
@@ -677,22 +677,6 @@ static irqreturn_t pcl818_interrupt(int irq, void *d)
        return IRQ_HANDLED;
 }
 
-static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
-                                   struct comedi_subdevice *s)
-{
-       unsigned int ctrl = 0;
-
-       pcl818_ai_setup_dma(dev, s);
-
-       ctrl |= PCL818_CTRL_INTE | PCL818_CTRL_IRQ(dev->irq) | PCL818_CTRL_DMAE;
-       if (mode == 1)
-               ctrl |= PCL818_CTRL_PACER_TRIG;
-       else
-               ctrl |= PCL818_CTRL_EXT_TRIG;
-
-       outb(ctrl, dev->iobase + PCL818_CTRL_REG);
-}
-
 static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
                              struct comedi_subdevice *s)
 {
@@ -722,28 +706,23 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
 
        outb(0, dev->iobase + PCL818_CNTENABLE);        /* enable pacer */
 
-       switch (devpriv->dma) {
-       case 1:         /*  DMA */
-       case 3:
-               pcl818_ai_mode13dma_int(mode, dev, s);
-               break;
-       case 0:
-               if (!devpriv->usefifo) {
-                       ctrl |= PCL818_CTRL_INTE | PCL818_CTRL_IRQ(dev->irq);
-                       if (mode == 1)
-                               ctrl |= PCL818_CTRL_PACER_TRIG;
-                       else
-                               ctrl |= PCL818_CTRL_EXT_TRIG;
-               } else {
-                       /* enable FIFO */
-                       outb(1, dev->iobase + PCL818_FI_ENABLE);
-                       if (mode == 1)
-                               ctrl |= PCL818_CTRL_PACER_TRIG;
-                       else
-                               ctrl |= PCL818_CTRL_EXT_TRIG;
-               }
-               outb(ctrl, dev->iobase + PCL818_CTRL_REG);
+       if (mode == 1)
+               ctrl |= PCL818_CTRL_PACER_TRIG;
+       else
+               ctrl |= PCL818_CTRL_EXT_TRIG;
+
+       if (devpriv->dma) {
+               pcl818_ai_setup_dma(dev, s);
+
+               ctrl |= PCL818_CTRL_INTE | PCL818_CTRL_IRQ(dev->irq) |
+                       PCL818_CTRL_DMAE;
+       } else if (devpriv->usefifo) {
+               /* enable FIFO */
+               outb(1, dev->iobase + PCL818_FI_ENABLE);
+       } else {
+               ctrl |= PCL818_CTRL_INTE | PCL818_CTRL_IRQ(dev->irq);
        }
+       outb(ctrl, dev->iobase + PCL818_CTRL_REG);
 
        pcl818_start_pacer(dev, mode == 1);