[PATCH 07/36] staging: comedi: ni_tio_internal.h: replace NITIO_Gi_LoadB_Reg()

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

 



The "LoadB" 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          | 14 +++++++-------
 drivers/staging/comedi/drivers/ni_tio_internal.h | 16 +---------------
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index f203a6c..2d20e8d 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -387,11 +387,11 @@ void ni_tio_init_counter(struct ni_gpct *counter)
 		       counter_dev->
 		       regs[NITIO_LOADA_REG(counter->counter_index)],
 		       NITIO_LOADA_REG(counter->counter_index));
-	counter_dev->regs[NITIO_Gi_LoadB_Reg(counter->counter_index)] = 0x0;
+	counter_dev->regs[NITIO_LOADB_REG(counter->counter_index)] = 0x0;
 	write_register(counter,
 		       counter_dev->
-		       regs[NITIO_Gi_LoadB_Reg(counter->counter_index)],
-		       NITIO_Gi_LoadB_Reg(counter->counter_index));
+		       regs[NITIO_LOADB_REG(counter->counter_index)],
+		       NITIO_LOADB_REG(counter->counter_index));
 	ni_tio_set_bits(counter,
 			NITIO_Gi_Input_Select_Reg(counter->counter_index), ~0,
 			0);
@@ -1669,7 +1669,7 @@ int ni_tio_rinsn(struct ni_gpct *counter, struct comedi_insn *insn,
 	case 2:
 		data[0] =
 		    counter_dev->
-		    regs[NITIO_Gi_LoadB_Reg(counter->counter_index)];
+		    regs[NITIO_LOADB_REG(counter->counter_index)];
 		break;
 	}
 	return 0;
@@ -1683,7 +1683,7 @@ static unsigned ni_tio_next_load_register(struct ni_gpct *counter)
 								 counter_index));
 
 	if (bits & Gi_Next_Load_Source_Bit(counter->counter_index))
-		return NITIO_Gi_LoadB_Reg(counter->counter_index);
+		return NITIO_LOADB_REG(counter->counter_index);
 	else
 		return NITIO_LOADA_REG(counter->counter_index);
 }
@@ -1716,10 +1716,10 @@ int ni_tio_winsn(struct ni_gpct *counter, struct comedi_insn *insn,
 			       NITIO_LOADA_REG(counter->counter_index));
 		break;
 	case 2:
-		counter_dev->regs[NITIO_Gi_LoadB_Reg(counter->counter_index)] =
+		counter_dev->regs[NITIO_LOADB_REG(counter->counter_index)] =
 		    data[0];
 		write_register(counter, data[0],
-			       NITIO_Gi_LoadB_Reg(counter->counter_index));
+			       NITIO_LOADB_REG(counter->counter_index));
 		break;
 	default:
 		return -EINVAL;
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 1df7870..d4176bf 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -26,6 +26,7 @@
 #define NITIO_SW_SAVE_REG(x)		(NITIO_G0_SW_SAVE + (x))
 #define NITIO_MODE_REG(x)		(NITIO_G0_MODE + (x))
 #define NITIO_LOADA_REG(x)		(NITIO_G0_LOADA + (x))
+#define NITIO_LOADB_REG(x)		(NITIO_G0_LOADB + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
 {
@@ -109,21 +110,6 @@ static inline enum ni_gpct_register NITIO_Gxx_Status_Reg(unsigned idx)
 	return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned idx)
-{
-	switch (idx) {
-	case 0:
-		return NITIO_G0_LOADB;
-	case 1:
-		return NITIO_G1_LOADB;
-	case 2:
-		return NITIO_G2_LOADB;
-	case 3:
-		return NITIO_G3_LOADB;
-	}
-	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