[PATCH 07/40] staging: comedi: ni_tio: tidy up ni_660x_set_first_gate()

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

 



Rename some of the local vars and tidy up this function to fix to
fix a couple > 80 char line issues.

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

diff --git a/drivers/staging/comedi/drivers/ni_tio.c b/drivers/staging/comedi/drivers/ni_tio.c
index fa1ca45..e613353 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -955,37 +955,33 @@ static void ni_tio_set_first_gate_modifiers(struct ni_gpct *counter,
 static int ni_660x_set_first_gate(struct ni_gpct *counter,
 				  unsigned int gate_source)
 {
-	const unsigned selected_gate = CR_CHAN(gate_source);
+	unsigned int chan = CR_CHAN(gate_source);
 	unsigned cidx = counter->counter_index;
-	/* bits of selected_gate that may be meaningful to input select register */
-	const unsigned selected_gate_mask = 0x1f;
-	unsigned ni_660x_gate_select;
+	unsigned gate_sel;
 	unsigned i;
 
-	switch (selected_gate) {
+	switch (chan) {
 	case NI_GPCT_NEXT_SOURCE_GATE_SELECT:
-		ni_660x_gate_select = NI_660x_Next_SRC_Gate_Select;
+		gate_sel = NI_660x_Next_SRC_Gate_Select;
 		break;
 	case NI_GPCT_NEXT_OUT_GATE_SELECT:
 	case NI_GPCT_LOGIC_LOW_GATE_SELECT:
 	case NI_GPCT_SOURCE_PIN_i_GATE_SELECT:
 	case NI_GPCT_GATE_PIN_i_GATE_SELECT:
-		ni_660x_gate_select = selected_gate & selected_gate_mask;
+		gate_sel = chan & 0x1f;
 		break;
 	default:
 		for (i = 0; i <= ni_660x_max_rtsi_channel; ++i) {
-			if (selected_gate == NI_GPCT_RTSI_GATE_SELECT(i)) {
-				ni_660x_gate_select =
-				    selected_gate & selected_gate_mask;
+			if (chan == NI_GPCT_RTSI_GATE_SELECT(i)) {
+				gate_sel = chan & 0x1f;
 				break;
 			}
 		}
 		if (i <= ni_660x_max_rtsi_channel)
 			break;
 		for (i = 0; i <= ni_660x_max_gate_pin; ++i) {
-			if (selected_gate == NI_GPCT_GATE_PIN_GATE_SELECT(i)) {
-				ni_660x_gate_select =
-				    selected_gate & selected_gate_mask;
+			if (chan == NI_GPCT_GATE_PIN_GATE_SELECT(i)) {
+				gate_sel = chan & 0x1f;
 				break;
 			}
 		}
@@ -994,8 +990,7 @@ static int ni_660x_set_first_gate(struct ni_gpct *counter,
 		return -EINVAL;
 	}
 	ni_tio_set_bits(counter, NITIO_INPUT_SEL_REG(cidx),
-			Gi_Gate_Select_Mask,
-			Gi_Gate_Select_Bits(ni_660x_gate_select));
+			Gi_Gate_Select_Mask, Gi_Gate_Select_Bits(gate_sel));
 	return 0;
 }
 
-- 
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