[PATCH 04/36] staging: comedi: ni_tio_internal.h: replace NITIO_Gi_SW_Save_Reg()

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

 



The "SW Save" 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          |  7 +++----
 drivers/staging/comedi/drivers/ni_tio_internal.h | 16 +---------------
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index d535bbb..38ad823 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -1648,15 +1648,14 @@ int ni_tio_rinsn(struct ni_gpct *counter, struct comedi_insn *insn,
 		   a third read will be correct since the count value will definitely have latched by then. */
 		first_read =
 		    read_register(counter,
-				  NITIO_Gi_SW_Save_Reg(counter->counter_index));
+				  NITIO_SW_SAVE_REG(counter->counter_index));
 		second_read =
 		    read_register(counter,
-				  NITIO_Gi_SW_Save_Reg(counter->counter_index));
+				  NITIO_SW_SAVE_REG(counter->counter_index));
 		if (first_read != second_read)
 			correct_read =
 			    read_register(counter,
-					  NITIO_Gi_SW_Save_Reg(counter->
-							       counter_index));
+				  NITIO_SW_SAVE_REG(counter->counter_index));
 		else
 			correct_read = first_read;
 		data[0] = correct_read;
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 9587b87..cda3875 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -23,6 +23,7 @@
 
 #define NITIO_AUTO_INC_REG(x)		(NITIO_G0_AUTO_INC + (x))
 #define NITIO_CMD_REG(x)		(NITIO_G0_CMD + (x))
+#define NITIO_SW_SAVE_REG(x)		(NITIO_G0_SW_SAVE + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
 {
@@ -151,21 +152,6 @@ static inline enum ni_gpct_register NITIO_Gi_Mode_Reg(unsigned idx)
 	return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gi_SW_Save_Reg(int idx)
-{
-	switch (idx) {
-	case 0:
-		return NITIO_G0_SW_SAVE;
-	case 1:
-		return NITIO_G1_SW_SAVE;
-	case 2:
-		return NITIO_G2_SW_SAVE;
-	case 3:
-		return NITIO_G3_SW_SAVE;
-	}
-	return 0;
-}
-
 static inline enum ni_gpct_register NITIO_Gi_Second_Gate_Reg(unsigned idx)
 {
 	switch (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