[PATCH 30/34] staging: comedi: addi_apci_3120: simplify analog input boardinfo

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

 



There are two boards supported by this driver. One with 16-bit analog
inputs and the other 12-bit analog inputs.

Add a bit field flag, 'ai_is_16bit', to the boardinfo and remove the
'i_AiMaxdata' member. Use the new flag to initialize tne analog input
subdevice maxdata correctly.

For aesthetics, adjust the whitespace in the boardinfo declaration.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/addi_apci_3120.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index de1dabf..9ba66d8 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -16,19 +16,18 @@ enum apci3120_boardid {
 
 struct apci3120_board {
 	const char *name;
-	int i_AiMaxdata;
+	unsigned int ai_is_16bit:1;
 	unsigned int has_ao:1;
 };
 
 static const struct apci3120_board apci3120_boardtypes[] = {
 	[BOARD_APCI3120] = {
-		.name			= "apci3120",
-		.i_AiMaxdata		= 0xffff,
-		.has_ao			= 1,
+		.name		= "apci3120",
+		.ai_is_16bit	= 1,
+		.has_ao		= 1,
 	},
 	[BOARD_APCI3001] = {
-		.name			= "apci3001",
-		.i_AiMaxdata		= 0xfff,
+		.name		= "apci3001",
 	},
 };
 
@@ -103,7 +102,7 @@ static int apci3120_auto_attach(struct comedi_device *dev,
 		SDF_READABLE | SDF_COMMON | SDF_GROUND
 		| SDF_DIFF;
 	s->n_chan = 16;
-	s->maxdata = this_board->i_AiMaxdata;
+	s->maxdata = this_board->ai_is_16bit ? 0xffff : 0x0fff;
 	s->len_chanlist = s->n_chan;
 	s->range_table = &range_apci3120_ai;
 
-- 
2.0.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