staging: comedi: cb_pcidas: tidy up caldac_8800_write()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Wed, 14 Oct 2015 00:47:48 +0000 (17:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Oct 2015 06:20:10 +0000 (23:20 -0700)
Rename this function so it has namespace associated with the driver.

For aesthetics, remove the 'static const' local variables. They don't
add any significant value.

Remove the 'bitstream' local variable. Change the type of the 'value'
param to match the callers type and write_calibration_bitstream()'s
type.

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

index 3c1a747ea1adcef3de7cd310dbd79d22d71db247..fb10fe6d380620264421ca182e6c9f6fc53d115c 100644 (file)
@@ -552,21 +552,22 @@ static void write_calibration_bitstream(struct comedi_device *dev,
        }
 }
 
-static void caldac_8800_write(struct comedi_device *dev,
-                             unsigned int chan, u8 val)
+static void cb_pcidas_caldac_8800_write(struct comedi_device *dev,
+                                       unsigned int chan, unsigned int val)
 {
        struct cb_pcidas_private *devpriv = dev->private;
-       static const int bitstream_length = 11;
-       unsigned int bitstream = ((chan & 0x7) << 8) | val;
-       static const int caldac_8800_udelay = 1;
 
-       write_calibration_bitstream(dev, cal_enable_bits(dev), bitstream,
-                                   bitstream_length);
+       /* write 11-bit value */
+       write_calibration_bitstream(dev, cal_enable_bits(dev),
+                                   ((chan & 0x7) << 8) | val, 11);
+       udelay(1);
 
-       udelay(caldac_8800_udelay);
+       /* select caldac */
        outw(cal_enable_bits(dev) | PCIDAS_CALIB_8800_SEL,
             devpriv->pcibar1 + PCIDAS_CALIB_REG);
-       udelay(caldac_8800_udelay);
+       udelay(1);
+
+       /* latch value */
        outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
 }
 
@@ -581,7 +582,7 @@ static int cb_pcidas_caldac_insn_write(struct comedi_device *dev,
                unsigned int val = data[insn->n - 1];
 
                if (s->readback[chan] != val) {
-                       caldac_8800_write(dev, chan, val);
+                       cb_pcidas_caldac_8800_write(dev, chan, val);
                        s->readback[chan] = val;
                }
        }
@@ -1431,7 +1432,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
                return ret;
 
        for (i = 0; i < s->n_chan; i++) {
-               caldac_8800_write(dev, i, s->maxdata / 2);
+               cb_pcidas_caldac_8800_write(dev, i, s->maxdata / 2);
                s->readback[i] = s->maxdata / 2;
        }