aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/drivers/cb_pcidas.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-10-13 17:47:46 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-10-16 23:20:10 -0700
commit8c11f4772c54d9bea4448ae9de1d4b99695ee72a (patch)
tree3a6b7ff7d90962e4273b9ef834d405155315c08f /drivers/staging/comedi/drivers/cb_pcidas.c
parentstaging: comedi: cb_pcidas: tidy up calibration trimpot subdevice (diff)
downloadlinux-dev-8c11f4772c54d9bea4448ae9de1d4b99695ee72a.tar.xz
linux-dev-8c11f4772c54d9bea4448ae9de1d4b99695ee72a.zip
staging: comedi: cb_pcidas: tidy up trimpot_7376_write()
Rename this function so it has namespace associated with the driver. Change the return type to void, it always returns '0' and the return value is never checked. For aesthetics, remove the 'static const' local variables. They don't add any significant value. Remove the 'bitstream' local variable. The 'value' passed to this function will always be in the correct range due to s->maxdata so the masking is not necessary. 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>
Diffstat (limited to 'drivers/staging/comedi/drivers/cb_pcidas.c')
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
index 99a95c2ccaa9..84bc3defcc2d 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -626,25 +626,23 @@ static int cb_pcidas_dac08_insn_write(struct comedi_device *dev,
return insn->n;
}
-static int trimpot_7376_write(struct comedi_device *dev, u8 value)
+static void cb_pcidas_trimpot_7376_write(struct comedi_device *dev,
+ unsigned int val)
{
struct cb_pcidas_private *devpriv = dev->private;
- static const int bitstream_length = 7;
- unsigned int bitstream = value & 0x7f;
- unsigned int register_bits;
- static const int ad7376_udelay = 1;
+ unsigned int calib_bits;
- register_bits = cal_enable_bits(dev) | PCIDAS_CALIB_TRIM_SEL;
- udelay(ad7376_udelay);
- outw(register_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG);
+ /* select trimpot */
+ calib_bits = cal_enable_bits(dev) | PCIDAS_CALIB_TRIM_SEL;
+ udelay(1);
+ outw(calib_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG);
- write_calibration_bitstream(dev, register_bits, bitstream,
- bitstream_length);
+ /* write 7-bit value */
+ write_calibration_bitstream(dev, calib_bits, val, 7);
+ udelay(1);
- udelay(ad7376_udelay);
+ /* latch value */
outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
-
- return 0;
}
static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel,
@@ -676,7 +674,7 @@ static void cb_pcidas_trimpot_write(struct comedi_device *dev,
switch (board->trimpot) {
case AD7376:
- trimpot_7376_write(dev, val);
+ cb_pcidas_trimpot_7376_write(dev, val);
break;
case AD8402:
trimpot_8402_write(dev, chan, val);