[PATCH v2 12/43] staging: comedi: ni_660x: tidy up ni_660x_read_register()

H Hartley Sweeten hsweeten at visionengravers.com
Tue Mar 22 18:10:22 UTC 2016


Rename this function to help shorten some of the long lines.

Remove the inline, let the compiler figure it out.

Change the 'unsigned' parameters to 'unsigned int' to fix the
checkpatch.pl issues:

WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
Cc: Ian Abbott <abbotti at mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/comedi/drivers/ni_660x.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
index aa40ab6..cd101bb 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -516,9 +516,9 @@ static void ni_660x_write(struct comedi_device *dev,
 		writel(bits, dev->mmio + addr);
 }
 
-static inline unsigned ni_660x_read_register(struct comedi_device *dev,
-					     unsigned chip,
-					     enum ni_660x_register reg)
+static unsigned int ni_660x_read(struct comedi_device *dev,
+				 unsigned int chip,
+				 enum ni_660x_register reg)
 {
 	unsigned int addr = GPCT_OFFSET[chip] + ni_660x_reg_data[reg].offset;
 
@@ -544,7 +544,7 @@ static unsigned ni_gpct_read_register(struct ni_gpct *counter,
 	enum ni_660x_register ni_660x_register = ni_gpct_to_660x_register(reg);
 	unsigned chip = counter->chip_index;
 
-	return ni_660x_read_register(dev, chip, ni_660x_register);
+	return ni_660x_read(dev, chip, ni_660x_register);
 }
 
 static inline struct mite_dma_descriptor_ring *mite_ring(struct ni_660x_private
@@ -812,7 +812,7 @@ static int ni_660x_dio_insn_bits(struct comedi_device *dev,
 	}
 	/* on return, data[1] contains the value of the digital
 	 * input and output lines. */
-	data[1] = (ni_660x_read_register(dev, 0, NI660X_DIO32_INPUT) >>
+	data[1] = (ni_660x_read(dev, 0, NI660X_DIO32_INPUT) >>
 			base_bitfield_channel);
 
 	return insn->n;
@@ -843,9 +843,8 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev,
 	}
 
 	if (idle_chipset != active_chipset) {
-		idle_bits =
-		    ni_660x_read_register(dev, idle_chipset,
-					  NI660X_IO_CFG(pfi_channel));
+		idle_bits = ni_660x_read(dev, idle_chipset,
+					 NI660X_IO_CFG(pfi_channel));
 		idle_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel);
 		idle_bits |=
 		    NI660X_IO_CFG_OUT_SEL(pfi_channel,
@@ -854,9 +853,8 @@ static void ni_660x_select_pfi_output(struct comedi_device *dev,
 			      NI660X_IO_CFG(pfi_channel));
 	}
 
-	active_bits =
-	    ni_660x_read_register(dev, active_chipset,
-				  NI660X_IO_CFG(pfi_channel));
+	active_bits = ni_660x_read(dev, active_chipset,
+				   NI660X_IO_CFG(pfi_channel));
 	active_bits &= ~NI660X_IO_CFG_OUT_SEL_MASK(pfi_channel);
 	active_bits |= NI660X_IO_CFG_OUT_SEL(pfi_channel, output_select);
 	ni_660x_write(dev, active_chipset, active_bits,
@@ -927,7 +925,7 @@ static int ni_660x_dio_insn_config(struct comedi_device *dev,
 		break;
 
 	case INSN_CONFIG_FILTER:
-		val = ni_660x_read_register(dev, 0, NI660X_IO_CFG(chan));
+		val = ni_660x_read(dev, 0, NI660X_IO_CFG(chan));
 		val &= ~NI660X_IO_CFG_IN_SEL_MASK(chan);
 		val |= NI660X_IO_CFG_IN_SEL(chan, data[1]);
 		ni_660x_write(dev, 0, val, NI660X_IO_CFG(chan));
-- 
2.6.3



More information about the devel mailing list