staging: comedi: addi_apci_3xxx: absorb i_APCI3XXX_InsnWriteAnalogOutput()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 12 Jun 2013 23:15:07 +0000 (16:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Jun 2013 21:33:42 +0000 (14:33 -0700)
Rename this CamelCase function and absorb it from hwdrv_apci3xxx.c
directly into the driver.

Tidy up the analog output subdevice init by adding some whitespace.

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_apci3xxx.c
drivers/staging/comedi/drivers/addi_apci_3xxx.c

index 7575464..dc4b165 100644 (file)
@@ -515,33 +515,6 @@ static int i_APCI3XXX_InsnReadAnalogInput(struct comedi_device *dev,
        return i_ReturnValue;
 }
 
-static int i_APCI3XXX_InsnWriteAnalogOutput(struct comedi_device *dev,
-                                           struct comedi_subdevice *s,
-                                           struct comedi_insn *insn,
-                                           unsigned int *data)
-{
-       struct apci3xxx_private *devpriv = dev->private;
-       unsigned int chan = CR_CHAN(insn->chanspec);
-       unsigned int range = CR_RANGE(insn->chanspec);
-       unsigned int status;
-       int i;
-
-       for (i = 0; i < insn->n; i++) {
-               /* Set the range selection */
-               writel(range, devpriv->dw_AiBase + 96);
-
-               /* Write the analog value to the selected channel */
-               writel((data[i] << 8) | chan, devpriv->dw_AiBase + 100);
-
-               /* Wait the end of transfer */
-               do {
-                       status = readl(devpriv->dw_AiBase + 96);
-               } while ((status & 0x100) != 0x100);
-       }
-
-       return insn->n;
-}
-
 /*
 +----------------------------------------------------------------------------+
 |                              TTL FUNCTIONS                                 |
index 8453dfe..c3dfe51 100644 (file)
@@ -416,6 +416,33 @@ static irqreturn_t apci3xxx_irq_handler(int irq, void *d)
        return IRQ_RETVAL(1);
 }
 
+static int apci3xxx_ao_insn_write(struct comedi_device *dev,
+                                 struct comedi_subdevice *s,
+                                 struct comedi_insn *insn,
+                                 unsigned int *data)
+{
+       struct apci3xxx_private *devpriv = dev->private;
+       unsigned int chan = CR_CHAN(insn->chanspec);
+       unsigned int range = CR_RANGE(insn->chanspec);
+       unsigned int status;
+       int i;
+
+       for (i = 0; i < insn->n; i++) {
+               /* Set the range selection */
+               writel(range, devpriv->dw_AiBase + 96);
+
+               /* Write the analog value to the selected channel */
+               writel((data[i] << 8) | chan, devpriv->dw_AiBase + 100);
+
+               /* Wait the end of transfer */
+               do {
+                       status = readl(devpriv->dw_AiBase + 96);
+               } while ((status & 0x100) != 0x100);
+       }
+
+       return insn->n;
+}
+
 static int apci3xxx_di_insn_bits(struct comedi_device *dev,
                                 struct comedi_subdevice *s,
                                 struct comedi_insn *insn,
@@ -553,17 +580,17 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
                s->type = COMEDI_SUBD_UNUSED;
        }
 
-       /*  Allocate and Initialise AO Subdevice Structures */
+       /* Analog Output subdevice */
        s = &dev->subdevices[1];
        if (board->has_ao) {
-               s->type = COMEDI_SUBD_AO;
-               s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
-               s->n_chan = 4;
-               s->maxdata = 0x0fff;
-               s->range_table = &apci3xxx_ao_range;
-               s->insn_write = i_APCI3XXX_InsnWriteAnalogOutput;
+               s->type         = COMEDI_SUBD_AO;
+               s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
+               s->n_chan       = 4;
+               s->maxdata      = 0x0fff;
+               s->range_table  = &apci3xxx_ao_range;
+               s->insn_write   = apci3xxx_ao_insn_write;
        } else {
-               s->type = COMEDI_SUBD_UNUSED;
+               s->type         = COMEDI_SUBD_UNUSED;
        }
 
        /* Digital Input subdevice */