[PATCH 36/40] staging: comedi: ni_tio: absorb ni_tio_set_first_gate_modifiers()

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

 



This function is only called by ni_tio_set_gate_src(). For aesthetics,
absorb the code into that function..

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 | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index eb54582..33ffd17 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -776,23 +776,6 @@ static void ni_tio_get_clock_src(struct ni_gpct *counter,
 	*period_ns = temp64;
 }
 
-static void ni_tio_set_first_gate_modifiers(struct ni_gpct *counter,
-					    unsigned int gate_source)
-{
-	const unsigned mode_mask = Gi_Gate_Polarity_Bit | Gi_Gating_Mode_Mask;
-	unsigned cidx = counter->counter_index;
-	unsigned mode_values = 0;
-
-	if (gate_source & CR_INVERT)
-		mode_values |= Gi_Gate_Polarity_Bit;
-	if (gate_source & CR_EDGE)
-		mode_values |= Gi_Rising_Edge_Gating_Bits;
-	else
-		mode_values |= Gi_Level_Gating_Bits;
-	ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
-			mode_mask, mode_values);
-}
-
 static int ni_660x_set_gate(struct ni_gpct *counter, unsigned int gate_source)
 {
 	unsigned int chan = CR_CHAN(gate_source);
@@ -953,6 +936,7 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
 	unsigned cidx = counter->counter_index;
 	unsigned int chan = CR_CHAN(gate_source);
 	unsigned gate2_reg = NITIO_GATE2_REG(cidx);
+	unsigned mode = 0;
 
 	switch (gate_index) {
 	case 0:
@@ -962,7 +946,15 @@ int ni_tio_set_gate_src(struct ni_gpct *counter, unsigned gate_index,
 					Gi_Gating_Disabled_Bits);
 			return 0;
 		}
-		ni_tio_set_first_gate_modifiers(counter, gate_source);
+		if (gate_source & CR_INVERT)
+			mode |= Gi_Gate_Polarity_Bit;
+		if (gate_source & CR_EDGE)
+			mode |= Gi_Rising_Edge_Gating_Bits;
+		else
+			mode |= Gi_Level_Gating_Bits;
+		ni_tio_set_bits(counter, NITIO_MODE_REG(cidx),
+				Gi_Gate_Polarity_Bit | Gi_Gating_Mode_Mask,
+				mode);
 		switch (counter_dev->variant) {
 		case ni_gpct_variant_e_series:
 		case ni_gpct_variant_m_series:
-- 
1.9.3

_______________________________________________
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