]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: addi_apci_3120: move timer helpers to main driver source
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:53:55 +0000 (10:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:33:58 +0000 (09:33 -0800)
Move the timer read/write and set mode helpers from the included source
file into the main driver source file.

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/addi-data/hwdrv_apci3120.c
drivers/staging/comedi/drivers/addi_apci_3120.c

index dc6eb56e0e1af30f09503d4b135e9e12b4f80492..d4d66e490b54852533b585e685a235b566aba1b1 100644 (file)
@@ -171,59 +171,6 @@ static const struct comedi_lrange range_apci3120_ai = {
        }
 };
 
-static void apci3120_timer_write(struct comedi_device *dev,
-                                unsigned int timer, unsigned int val)
-{
-       struct apci3120_private *devpriv = dev->private;
-
-       /* write 16-bit value to timer (lower 16-bits of timer 2) */
-       outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
-            APCI3120_CTR0_TIMER_SEL(timer),
-            dev->iobase + APCI3120_CTR0_REG);
-       outw(val & 0xffff, dev->iobase + APCI3120_TIMER_REG);
-
-       if (timer == 2) {
-               /* write upper 16-bits to timer 2 */
-               outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
-                    APCI3120_CTR0_TIMER_SEL(timer + 1),
-                    dev->iobase + APCI3120_CTR0_REG);
-               outw((val >> 16) & 0xffff, dev->iobase + APCI3120_TIMER_REG);
-       }
-}
-
-static unsigned int apci3120_timer_read(struct comedi_device *dev,
-                                       unsigned int timer)
-{
-       struct apci3120_private *devpriv = dev->private;
-       unsigned int val;
-
-       /* read 16-bit value from timer (lower 16-bits of timer 2) */
-       outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
-            APCI3120_CTR0_TIMER_SEL(timer),
-            dev->iobase + APCI3120_CTR0_REG);
-       val = inw(dev->iobase + APCI3120_TIMER_REG);
-
-       if (timer == 2) {
-               /* read upper 16-bits from timer 2 */
-               outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
-                    APCI3120_CTR0_TIMER_SEL(timer + 1),
-                    dev->iobase + APCI3120_CTR0_REG);
-               val |= (inw(dev->iobase + APCI3120_TIMER_REG) << 16);
-       }
-
-       return val;
-}
-
-static void apci3120_timer_set_mode(struct comedi_device *dev,
-                                   unsigned int timer, unsigned int mode)
-{
-       struct apci3120_private *devpriv = dev->private;
-
-       devpriv->timer_mode &= ~APCI3120_TIMER_MODE_MASK(timer);
-       devpriv->timer_mode |= APCI3120_TIMER_MODE(timer, mode);
-       outb(devpriv->timer_mode, dev->iobase + APCI3120_TIMER_MODE_REG);
-}
-
 static int apci3120_ai_insn_config(struct comedi_device *dev,
                                   struct comedi_subdevice *s,
                                   struct comedi_insn *insn,
index 20babacd40d3551b3360776702431c3912b62b4a..e53561194bae5dff83a27e3d5901e8bdde3fdc1d 100644 (file)
@@ -150,6 +150,59 @@ static unsigned int apci3120_ns_to_timer(struct comedi_device *dev,
        return divisor;
 }
 
+static void apci3120_timer_write(struct comedi_device *dev,
+                                unsigned int timer, unsigned int val)
+{
+       struct apci3120_private *devpriv = dev->private;
+
+       /* write 16-bit value to timer (lower 16-bits of timer 2) */
+       outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
+            APCI3120_CTR0_TIMER_SEL(timer),
+            dev->iobase + APCI3120_CTR0_REG);
+       outw(val & 0xffff, dev->iobase + APCI3120_TIMER_REG);
+
+       if (timer == 2) {
+               /* write upper 16-bits to timer 2 */
+               outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
+                    APCI3120_CTR0_TIMER_SEL(timer + 1),
+                    dev->iobase + APCI3120_CTR0_REG);
+               outw((val >> 16) & 0xffff, dev->iobase + APCI3120_TIMER_REG);
+       }
+}
+
+static unsigned int apci3120_timer_read(struct comedi_device *dev,
+                                       unsigned int timer)
+{
+       struct apci3120_private *devpriv = dev->private;
+       unsigned int val;
+
+       /* read 16-bit value from timer (lower 16-bits of timer 2) */
+       outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
+            APCI3120_CTR0_TIMER_SEL(timer),
+            dev->iobase + APCI3120_CTR0_REG);
+       val = inw(dev->iobase + APCI3120_TIMER_REG);
+
+       if (timer == 2) {
+               /* read upper 16-bits from timer 2 */
+               outb(APCI3120_CTR0_DO_BITS(devpriv->do_bits) |
+                    APCI3120_CTR0_TIMER_SEL(timer + 1),
+                    dev->iobase + APCI3120_CTR0_REG);
+               val |= (inw(dev->iobase + APCI3120_TIMER_REG) << 16);
+       }
+
+       return val;
+}
+
+static void apci3120_timer_set_mode(struct comedi_device *dev,
+                                   unsigned int timer, unsigned int mode)
+{
+       struct apci3120_private *devpriv = dev->private;
+
+       devpriv->timer_mode &= ~APCI3120_TIMER_MODE_MASK(timer);
+       devpriv->timer_mode |= APCI3120_TIMER_MODE(timer, mode);
+       outb(devpriv->timer_mode, dev->iobase + APCI3120_TIMER_MODE_REG);
+}
+
 #include "addi-data/hwdrv_apci3120.c"
 
 static void apci3120_dma_alloc(struct comedi_device *dev)