[PATCH 02/36] staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Autoincrement_Reg()

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

 



The "AutoIncrement" registers are sequential in the enum ni_gpct_register.
Replace this inline CamelCase function with a simple define.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_tio.c          |  6 +++---
 drivers/staging/comedi/drivers/ni_tio_internal.h | 15 +--------------
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index cf8892b..6fa72f0 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -372,12 +372,12 @@ void ni_tio_init_counter(struct ni_gpct *counter)
 
 	ni_tio_reset_count_and_disarm(counter);
 	/* initialize counter registers */
-	counter_dev->regs[NITIO_Gi_Autoincrement_Reg(counter->counter_index)] =
+	counter_dev->regs[NITIO_AUTO_INC_REG(counter->counter_index)] =
 	    0x0;
 	write_register(counter,
 		       counter_dev->
-		       regs[NITIO_Gi_Autoincrement_Reg(counter->counter_index)],
-		       NITIO_Gi_Autoincrement_Reg(counter->counter_index));
+		       regs[NITIO_AUTO_INC_REG(counter->counter_index)],
+		       NITIO_AUTO_INC_REG(counter->counter_index));
 	ni_tio_set_bits(counter, NITIO_Gi_Command_Reg(counter->counter_index),
 			~0, Gi_Synchronize_Gate_Bit);
 	ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index), ~0,
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 88d51e4..5d3899f 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -21,20 +21,7 @@
 
 #include "ni_tio.h"
 
-static inline enum ni_gpct_register NITIO_Gi_Autoincrement_Reg(unsigned idx)
-{
-	switch (idx) {
-	case 0:
-		return NITIO_G0_AUTO_INC;
-	case 1:
-		return NITIO_G1_AUTO_INC;
-	case 2:
-		return NITIO_G2_AUTO_INC;
-	case 3:
-		return NITIO_G3_AUTO_INC;
-	}
-	return 0;
-}
+#define NITIO_AUTO_INC_REG(x)		(NITIO_G0_AUTO_INC + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Command_Reg(unsigned idx)
 {
-- 
1.8.5.2

_______________________________________________
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