staging: comedi: cb_pcidas: absorb cal_enable_bits()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 19 Oct 2015 16:43:58 +0000 (09:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:15:22 +0000 (19:15 -0700)
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 <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 c334e4baeeda1bdcff370b3b91386eaa5206329f..b763f25acad703f9491a2e0cba83af71c975ce47 100644 (file)
@@ -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);