summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-01-20 14:53:00 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-25 19:59:10 +0800
commit068de2b65b9d14777c7d30853a332ccead664b94 (patch)
treec809a8dfbe4f98cd294a2fb6e27a1f03dc1c6717
parentc5b6b54488d0cd054ab28f86565aeef537d7ee65 (diff)
staging: comedi: adv_pci1710: simplify digital input and output boardinfo
The boards that have digital inputs and outputs always have 16 input channels and 16 output channels. Replace the 'n_dichan' and 'n_dochan' members of the boardinfo with the fit-field flag 'has_di_do' and refactor the board attach accordingly. Remove the unnecessary initialization of the subdevice 'len_chanlist'. That member is only used by subdevices that support async commands. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1710.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 9f88cfb47d41..667900f038ce 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -196,8 +196,6 @@ struct boardtype {
int n_aichan; /* num of A/D chans */
int n_aichand; /* num of A/D chans in diff mode */
int n_aochan; /* num of D/A chans */
- int n_dichan; /* num of DI chans */
- int n_dochan; /* num of DO chans */
int ai_maxdata; /* resolution of A/D */
int ao_maxdata; /* resolution of D/A */
const struct comedi_lrange *rangelist_ai; /* rangelist for A/D */
@@ -205,6 +203,7 @@ struct boardtype {
const struct comedi_lrange *rangelist_ao; /* rangelist for D/A */
unsigned int ai_ns_min; /* max sample speed of card v ns */
unsigned int fifo_half_size; /* size of FIFO/2 */
+ unsigned int has_di_do:1;
unsigned int has_counter:1;
};
@@ -216,8 +215,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan = 16,
.n_aichand = 8,
.n_aochan = 2,
- .n_dichan = 16,
- .n_dochan = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai = &range_pci1710_3,
@@ -225,6 +222,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao = &range_pci171x_da,
.ai_ns_min = 10000,
.fifo_half_size = 2048,
+ .has_di_do = 1,
.has_counter = 1,
},
[BOARD_PCI1710HG] = {
@@ -234,8 +232,6 @@ static const struct boardtype boardtypes[] = {
.n_aichan = 16,
.n_aichand = 8,
.n_aochan = 2,
- .n_dichan = 16,
- .n_dochan = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai = &range_pci1710hg,
@@ -243,6 +239,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao = &range_pci171x_da,
.ai_ns_min = 10000,
.fifo_half_size = 2048,
+ .has_di_do = 1,
.has_counter = 1,
},
[BOARD_PCI1711] = {
@@ -251,8 +248,6 @@ static const struct boardtype boardtypes[] = {
.cardtype = TYPE_PCI171X,
.n_aichan = 16,
.n_aochan = 2,
- .n_dichan = 16,
- .n_dochan = 16,
.ai_maxdata = 0x0fff,
.ao_maxdata = 0x0fff,
.rangelist_ai = &range_pci17x1,
@@ -260,6 +255,7 @@ static const struct boardtype boardtypes[] = {
.rangelist_ao = &range_pci171x_da,
.ai_ns_min = 10000,
.fifo_half_size = 512,
+ .has_di_do = 1,
.has_counter = 1,
},
[BOARD_PCI1713] = {
@@ -286,13 +282,12 @@ static const struct boardtype boardtypes[] = {
.have_irq = 1,
.cardtype = TYPE_PCI171X,
.n_aichan = 16,
- .n_dichan = 16,
- .n_dochan = 16,
.ai_maxdata = 0x0fff,
.rangelist_ai = &range_pci17x1,
.rangecode_ai = range_codes_pci17x1,
.ai_ns_min = 10000,
.fifo_half_size = 512,
+ .has_di_do = 1,
},
};
@@ -1118,10 +1113,8 @@ static int pci1710_auto_attach(struct comedi_device *dev,
n_subdevices++;
if (this_board->n_aochan)
n_subdevices++;
- if (this_board->n_dichan)
- n_subdevices++;
- if (this_board->n_dochan)
- n_subdevices++;
+ if (this_board->has_di_do)
+ n_subdevices += 2;
if (this_board->has_counter)
n_subdevices++;
@@ -1181,25 +1174,21 @@ static int pci1710_auto_attach(struct comedi_device *dev,
subdev++;
}
- if (this_board->n_dichan) {
+ if (this_board->has_di_do) {
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
- s->n_chan = this_board->n_dichan;
+ s->n_chan = 16;
s->maxdata = 1;
- s->len_chanlist = this_board->n_dichan;
s->range_table = &range_digital;
s->insn_bits = pci171x_insn_bits_di;
subdev++;
- }
- if (this_board->n_dochan) {
s = &dev->subdevices[subdev];
s->type = COMEDI_SUBD_DO;
s->subdev_flags = SDF_WRITABLE;
- s->n_chan = this_board->n_dochan;
+ s->n_chan = 16;
s->maxdata = 1;
- s->len_chanlist = this_board->n_dochan;
s->range_table = &range_digital;
s->insn_bits = pci171x_insn_bits_do;
subdev++;