From: H Hartley Sweeten Date: Mon, 19 Oct 2015 16:43:58 +0000 (-0700) Subject: staging: comedi: cb_pcidas: absorb cal_enable_bits() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=042bac563b28c8067fa958470dd5c1dc31d42cb2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index c334e4baeeda..b763f25acad7 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -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);