mirror of https://gitee.com/openkylin/linux.git
staging: comedi: cb_pcidas: tidy up trimpot_8402_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>
This commit is contained in:
parent
8c11f4772c
commit
6eb2455dcf
|
@ -645,26 +645,24 @@ static void cb_pcidas_trimpot_7376_write(struct comedi_device *dev,
|
||||||
outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trimpot_8402_write(struct comedi_device *dev, unsigned int channel,
|
static void cb_pcidas_trimpot_8402_write(struct comedi_device *dev,
|
||||||
u8 value)
|
unsigned int chan, unsigned int val)
|
||||||
{
|
{
|
||||||
struct cb_pcidas_private *devpriv = dev->private;
|
struct cb_pcidas_private *devpriv = dev->private;
|
||||||
static const int bitstream_length = 10;
|
unsigned int calib_bits;
|
||||||
unsigned int bitstream = ((channel & 0x3) << 8) | (value & 0xff);
|
|
||||||
unsigned int register_bits;
|
|
||||||
static const int ad8402_udelay = 1;
|
|
||||||
|
|
||||||
register_bits = cal_enable_bits(dev) | PCIDAS_CALIB_TRIM_SEL;
|
/* select trimpot */
|
||||||
udelay(ad8402_udelay);
|
calib_bits = cal_enable_bits(dev) | PCIDAS_CALIB_TRIM_SEL;
|
||||||
outw(register_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
udelay(1);
|
||||||
|
outw(calib_bits, devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
||||||
|
|
||||||
write_calibration_bitstream(dev, register_bits, bitstream,
|
/* write 10-bit value */
|
||||||
bitstream_length);
|
write_calibration_bitstream(dev, calib_bits,
|
||||||
|
((chan & 0x3) << 8) | val, 10);
|
||||||
|
udelay(1);
|
||||||
|
|
||||||
udelay(ad8402_udelay);
|
/* latch value */
|
||||||
outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
outw(cal_enable_bits(dev), devpriv->pcibar1 + PCIDAS_CALIB_REG);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cb_pcidas_trimpot_write(struct comedi_device *dev,
|
static void cb_pcidas_trimpot_write(struct comedi_device *dev,
|
||||||
|
@ -677,7 +675,7 @@ static void cb_pcidas_trimpot_write(struct comedi_device *dev,
|
||||||
cb_pcidas_trimpot_7376_write(dev, val);
|
cb_pcidas_trimpot_7376_write(dev, val);
|
||||||
break;
|
break;
|
||||||
case AD8402:
|
case AD8402:
|
||||||
trimpot_8402_write(dev, chan, val);
|
cb_pcidas_trimpot_8402_write(dev, chan, val);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(dev->class_dev, "driver bug?\n");
|
dev_err(dev->class_dev, "driver bug?\n");
|
||||||
|
|
Loading…
Reference in New Issue