[PATCH 29/34] staging: comedi: addi_apci_3120: simplify analog output boardinfo

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

 



There are two boards supported by this driver. One with eight 14-bit analog
outputs and the other without analog outputs.

Add a bit field flag, 'has_ao', to the boardinfo and remove the 'i_NbrAoChannel'
and 'i_AoMaxdata' members. Use the new flag to determine if the analog output
subdevice needs to be initialized and open code the n_chan and maxdata.

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, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index d555427..de1dabf 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -16,17 +16,15 @@ enum apci3120_boardid {
 
 struct apci3120_board {
 	const char *name;
-	int i_NbrAoChannel;
 	int i_AiMaxdata;
-	int i_AoMaxdata;
+	unsigned int has_ao:1;
 };
 
 static const struct apci3120_board apci3120_boardtypes[] = {
 	[BOARD_APCI3120] = {
 		.name			= "apci3120",
-		.i_NbrAoChannel		= 8,
 		.i_AiMaxdata		= 0xffff,
-		.i_AoMaxdata		= 0x3fff,
+		.has_ao			= 1,
 	},
 	[BOARD_APCI3001] = {
 		.name			= "apci3001",
@@ -117,12 +115,11 @@ static int apci3120_auto_attach(struct comedi_device *dev,
 
 	/*  Allocate and Initialise AO Subdevice Structures */
 	s = &dev->subdevices[1];
-	if (this_board->i_NbrAoChannel) {
+	if (this_board->has_ao) {
 		s->type = COMEDI_SUBD_AO;
 		s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON;
-		s->n_chan = this_board->i_NbrAoChannel;
-		s->maxdata = this_board->i_AoMaxdata;
-		s->len_chanlist = this_board->i_NbrAoChannel;
+		s->n_chan = 8;
+		s->maxdata = 0x3fff;
 		s->range_table = &range_apci3120_ao;
 		s->insn_write = apci3120_ao_insn_write;
 	} else {
-- 
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