[PATCH 3/7] staging: comedi: cb_pcidas: absorb cal_enable_bits()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/cb_pcidas.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
index c334e4b..b763f25 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);
-- 
2.5.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux