[PATCH 007/107] staging: comedi: ni_stc.h: reg_type is not needed by MSeries_AI_Config_Bank_Bits()

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

 



This helper function sets the bits in the M_Offset_AI_Config_FIFO_Data register
to select the correct bank to configure a given analog output channel. The NI
M Series boards are defined by the boardinfo to have 16, 32, or 80 channels.
Only 2 of the M Series boards have 80 channels, those boards happen to have a
reg_type of ni_reg_622x.

The bank for the 16 and 32 channel boards is selected by the 'channel & 0x30'
calculation (comedi channels 0 to 15 or 31). This also selects the bank for the
first 64 channels of the 80 channel boards. The additional '|= 0x400' sets the
bank to access the extra channels (comedi channels >= 63).

Since all the non ni_reg_622x boards have at most 32 channels, the extra check
of the 'reg_type' is not required in this function. Remove it as well as the
parameter.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_mio_common.c |  3 +--
 drivers/staging/comedi/drivers/ni_stc.h        | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index c1b1d7c..7e038a2 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1808,8 +1808,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev,
 			break;
 		}
 		config_bits |= MSeries_AI_Config_Channel_Bits(chan);
-		config_bits |=
-		    MSeries_AI_Config_Bank_Bits(board->reg_type, chan);
+		config_bits |= MSeries_AI_Config_Bank_Bits(chan);
 		config_bits |= MSeries_AI_Config_Gain_Bits(range_code);
 		if (i == n_chan - 1)
 			config_bits |= MSeries_AI_Config_Last_Channel_Bit;
diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h
index 2efd1ec..aca6e5c 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -990,14 +990,12 @@ static inline unsigned MSeries_AI_Config_Channel_Bits(unsigned channel)
 	return channel & 0xf;
 }
 
-static inline unsigned MSeries_AI_Config_Bank_Bits(enum ni_reg_type reg_type,
-						   unsigned channel)
+static inline unsigned MSeries_AI_Config_Bank_Bits(unsigned channel)
 {
 	unsigned bits = channel & 0x30;
-	if (reg_type == ni_reg_622x) {
-		if (channel & 0x40)
-			bits |= 0x400;
-	}
+
+	if (channel & 0x40)
+		bits |= 0x400;
 	return bits;
 }
 
-- 
2.3.0

_______________________________________________
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