Commit 042bac56 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: cb_pcidas: absorb cal_enable_bits()

This inline function just returns the bits needd to enable
a calibration source. For aethetics, absorb it into the callers.
Sorten the variable name in the private data used to hold the
current calibration source.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46c95d97
......@@ -313,16 +313,9 @@ struct cb_pcidas_private {
/* fifo buffers */
unsigned short ai_buffer[AI_BUFFER_SIZE];
unsigned short ao_buffer[AO_BUFFER_SIZE];
unsigned int calibration_source;
unsigned int calib_src;
};
static inline unsigned int cal_enable_bits(struct comedi_device *dev)
{
struct cb_pcidas_private *devpriv = dev->private;
return PCIDAS_CALIB_EN | PCIDAS_CALIB_SRC(devpriv->calibration_source);
}
static int cb_pcidas_ai_eoc(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
......@@ -352,7 +345,7 @@ static int cb_pcidas_ai_insn_read(struct comedi_device *dev,
/* enable calibration input if appropriate */
if (insn->chanspec & CR_ALT_SOURCE) {
outw(cal_enable_bits(dev),
outw(PCIDAS_CALIB_EN | PCIDAS_CALIB_SRC(devpriv->calib_src),
devpriv->pcibar1 + PCIDAS_CALIB_REG);
chan = 0;
} else {
......@@ -407,7 +400,7 @@ static int cb_pcidas_ai_insn_config(struct comedi_device *dev,
source);
return -EINVAL;
}
devpriv->calibration_source = source;
devpriv->calib_src = source;
break;
default:
return -EINVAL;
......@@ -532,9 +525,10 @@ static void cb_pcidas_calib_write(struct comedi_device *dev,
bool trimpot)
{
struct cb_pcidas_private *devpriv = dev->private;
unsigned int calib_bits = cal_enable_bits(dev);
unsigned int calib_bits;
unsigned int bit;
calib_bits = PCIDAS_CALIB_EN | PCIDAS_CALIB_SRC(devpriv->calib_src);
if (trimpot) {
/* select trimpot */
calib_bits |= PCIDAS_CALIB_TRIM_SEL;
......@@ -552,7 +546,7 @@ static void cb_pcidas_calib_write(struct comedi_device *dev,
}
udelay(1);
calib_bits = cal_enable_bits(dev);
calib_bits = PCIDAS_CALIB_EN | PCIDAS_CALIB_SRC(devpriv->calib_src);
if (!trimpot) {
/* select caldac */
......@@ -590,7 +584,7 @@ static void cb_pcidas_dac08_write(struct comedi_device *dev, unsigned int val)
{
struct cb_pcidas_private *devpriv = dev->private;
val |= cal_enable_bits(dev);
val |= PCIDAS_CALIB_EN | PCIDAS_CALIB_SRC(devpriv->calib_src);
/* latch the new value into the caldac */
outw(val, devpriv->pcibar1 + PCIDAS_CALIB_REG);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment