[PATCH 05/36] staging: comedi: ni_tio_internal.h: replace NITIO_Gi_Mode_Reg()

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

 



The "Mode" 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          | 10 +++++-----
 drivers/staging/comedi/drivers/ni_tio_internal.h | 16 +---------------
 drivers/staging/comedi/drivers/ni_tiocmd.c       |  2 +-
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index 38ad823..5b46324 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -380,7 +380,7 @@ void ni_tio_init_counter(struct ni_gpct *counter)
 		       NITIO_AUTO_INC_REG(counter->counter_index));
 	ni_tio_set_bits(counter, NITIO_CMD_REG(counter->counter_index),
 			~0, Gi_Synchronize_Gate_Bit);
-	ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index), ~0,
+	ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index), ~0,
 			0);
 	counter_dev->regs[NITIO_Gi_LoadA_Reg(counter->counter_index)] = 0x0;
 	write_register(counter,
@@ -502,7 +502,7 @@ static int ni_tio_set_counter_mode(struct ni_gpct *counter, unsigned mode)
 	default:
 		break;
 	}
-	ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index),
+	ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index),
 			mode_reg_mask, mode_reg_values);
 
 	if (ni_tio_counting_mode_registers_present(counter_dev)) {
@@ -1030,7 +1030,7 @@ static void ni_tio_set_first_gate_modifiers(struct ni_gpct *counter,
 		mode_values |= Gi_Rising_Edge_Gating_Bits;
 	else
 		mode_values |= Gi_Level_Gating_Bits;
-	ni_tio_set_bits(counter, NITIO_Gi_Mode_Reg(counter->counter_index),
+	ni_tio_set_bits(counter, NITIO_MODE_REG(counter->counter_index),
 			mode_mask, mode_values);
 }
 
@@ -1229,7 +1229,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
 	case 0:
 		if (CR_CHAN(gate_source) == NI_GPCT_DISABLED_GATE_SELECT) {
 			ni_tio_set_bits(counter,
-					NITIO_Gi_Mode_Reg(counter->
+					NITIO_MODE_REG(counter->
 							  counter_index),
 					Gi_Gating_Mode_Mask,
 					Gi_Gating_Disabled_Bits);
@@ -1491,7 +1491,7 @@ static int ni_tio_get_gate_src(struct ni_gpct *counter, unsigned gate_index,
 {
 	struct ni_gpct_device *counter_dev = counter->counter_dev;
 	const unsigned mode_bits = ni_tio_get_soft_copy(counter,
-							NITIO_Gi_Mode_Reg
+							NITIO_MODE_REG
 							(counter->
 							 counter_index));
 	const unsigned second_gate_reg =
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h
index cda3875..1f7cc42 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -24,6 +24,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))
+#define NITIO_MODE_REG(x)		(NITIO_G0_MODE + (x))
 
 static inline enum ni_gpct_register NITIO_Gi_Counting_Mode_Reg(unsigned idx)
 {
@@ -137,21 +138,6 @@ static inline enum ni_gpct_register NITIO_Gi_LoadB_Reg(unsigned idx)
 	return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gi_Mode_Reg(unsigned idx)
-{
-	switch (idx) {
-	case 0:
-		return NITIO_G0_MODE;
-	case 1:
-		return NITIO_G1_MODE;
-	case 2:
-		return NITIO_G2_MODE;
-	case 3:
-		return NITIO_G3_MODE;
-	}
-	return 0;
-}
-
 static inline enum ni_gpct_register NITIO_Gi_Second_Gate_Reg(unsigned idx)
 {
 	switch (idx) {
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c
index 4fb4df0..b78103d 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -401,7 +401,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
 			       (counter->counter_index));
 	if (ni_tio_get_soft_copy
 	    (counter,
-	     NITIO_Gi_Mode_Reg(counter->counter_index)) &
+	     NITIO_MODE_REG(counter->counter_index)) &
 	    Gi_Loading_On_Gate_Bit) {
 		if (gxx_status & Gi_Stale_Data_Bit(counter->counter_index)) {
 			if (stale_data)
-- 
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