[PATCH 11/36] staging: comedi: ni_tio_internal.h: replace NITIO_Gxx_Status_Reg()

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

 



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

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index 5203103..7da8228 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -425,7 +425,7 @@ static unsigned int ni_tio_counter_status(struct ni_gpct *counter)
 {
 	unsigned int status = 0;
 	const unsigned bits = read_register(counter,
-					    NITIO_Gxx_Status_Reg(counter->
+					    NITIO_STATUS_REG(counter->
 								 counter_index));
 	if (bits & Gi_Armed_Bit(counter->counter_index)) {
 		status |= COMEDI_COUNTER_ARMED;
@@ -1679,7 +1679,7 @@ EXPORT_SYMBOL_GPL(ni_tio_rinsn);
 static unsigned ni_tio_next_load_register(struct ni_gpct *counter)
 {
 	const unsigned bits = read_register(counter,
-					    NITIO_Gxx_Status_Reg(counter->
+					    NITIO_STATUS_REG(counter->
 								 counter_index));
 
 	if (bits & Gi_Next_Load_Source_Bit(counter->counter_index))
diff --git a/drivers/staging/comedi/drivers/ni_tio_internal.h b/drivers/staging/comedi/drivers/ni_tio_internal.h
index 1ef5f35..604fa69 100644
--- a/drivers/staging/comedi/drivers/ni_tio_internal.h
+++ b/drivers/staging/comedi/drivers/ni_tio_internal.h
@@ -30,6 +30,7 @@
 #define NITIO_INPUT_SEL_REG(x)		(NITIO_G0_INPUT_SEL + (x))
 #define NITIO_CNT_MODE_REG(x)		(NITIO_G0_CNT_MODE + (x))
 #define NITIO_GATE2_REG(x)		(NITIO_G0_GATE2 + (x))
+#define NITIO_STATUS_REG(x)		(NITIO_G01_STATUS + ((x) / 2))
 
 static inline enum ni_gpct_register NITIO_Gxx_Joint_Reset_Reg(unsigned idx)
 {
@@ -70,19 +71,6 @@ static inline enum ni_gpct_register NITIO_Gxx_Joint_Status2_Reg(unsigned idx)
 	return 0;
 }
 
-static inline enum ni_gpct_register NITIO_Gxx_Status_Reg(unsigned idx)
-{
-	switch (idx) {
-	case 0:
-	case 1:
-		return NITIO_G01_STATUS;
-	case 2:
-	case 3:
-		return NITIO_G23_STATUS;
-	}
-	return 0;
-}
-
 static inline enum ni_gpct_register NITIO_Gi_DMA_Config_Reg(unsigned idx)
 {
 	switch (idx) {
diff --git a/drivers/staging/comedi/drivers/ni_tiocmd.c b/drivers/staging/comedi/drivers/ni_tiocmd.c
index b3dad4f..0ffb3a4 100644
--- a/drivers/staging/comedi/drivers/ni_tiocmd.c
+++ b/drivers/staging/comedi/drivers/ni_tiocmd.c
@@ -354,7 +354,7 @@ void ni_tio_acknowledge_and_confirm(struct ni_gpct *counter, int *gate_error,
 				    int *stale_data)
 {
 	const unsigned short gxx_status = read_register(counter,
-							NITIO_Gxx_Status_Reg
+							NITIO_STATUS_REG
 							(counter->
 							 counter_index));
 	const unsigned short gi_status = read_register(counter,
-- 
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