The "st-da" board types have 4 analog output channels. All other board types, with analog outputs, only have 2 channels. Replace the 'ao_n_chan' member of the boardinfo with a bit-field flag, 'has_4_ao_chan' and only set it for the "st-da" boards. Remove the unnecessary initialization for all other boards. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/das1800.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 6472a36..88ba051 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -204,12 +204,12 @@ static const struct comedi_lrange range_ai_das1802 = { struct das1800_board { const char *name; int ai_speed; /* max conversion period in nanoseconds */ - int ao_n_chan; /* number of analog out channels */ const struct comedi_lrange *range_ai; /* available input ranges */ unsigned int is_16bit:1; unsigned int has_64_ai_chan:1; unsigned int has_ao:1; unsigned int has_wform_ao:1; + unsigned int has_4_ao_chan:1; unsigned int has_8_do_chan:1; }; @@ -225,9 +225,9 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1701st-da", .ai_speed = 6250, - .ao_n_chan = 4, .range_ai = &range_ai_das1801, .has_ao = 1, + .has_4_ao_chan = 1, }, { .name = "das-1702st", .ai_speed = 6250, @@ -235,9 +235,9 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1702st-da", .ai_speed = 6250, - .ao_n_chan = 4, .range_ai = &range_ai_das1802, .has_ao = 1, + .has_4_ao_chan = 1, }, { .name = "das-1702hr", .ai_speed = 20000, @@ -246,20 +246,17 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1702hr-da", .ai_speed = 20000, - .ao_n_chan = 2, .range_ai = &range_ai_das1802, .is_16bit = 1, .has_ao = 1, }, { .name = "das-1701ao", .ai_speed = 6250, - .ao_n_chan = 2, .range_ai = &range_ai_das1801, .has_wform_ao = 1, }, { .name = "das-1702ao", .ai_speed = 6250, - .ao_n_chan = 2, .range_ai = &range_ai_das1802, .has_wform_ao = 1, }, { @@ -269,9 +266,9 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1801st-da", .ai_speed = 3000, - .ao_n_chan = 4, .range_ai = &range_ai_das1801, .has_ao = 1, + .has_4_ao_chan = 1, }, { .name = "das-1802st", .ai_speed = 3000, @@ -279,9 +276,9 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1802st-da", .ai_speed = 3000, - .ao_n_chan = 4, .range_ai = &range_ai_das1802, .has_ao = 1, + .has_4_ao_chan = 1, }, { .name = "das-1802hr", .ai_speed = 10000, @@ -290,14 +287,12 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1802hr-da", .ai_speed = 10000, - .ao_n_chan = 2, .range_ai = &range_ai_das1802, .is_16bit = 1, .has_ao = 1, }, { .name = "das-1801hc", .ai_speed = 3000, - .ao_n_chan = 2, .range_ai = &range_ai_das1801, .has_64_ai_chan = 1, .has_ao = 1, @@ -305,7 +300,6 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1802hc", .ai_speed = 3000, - .ao_n_chan = 2, .range_ai = &range_ai_das1802, .has_64_ai_chan = 1, .has_ao = 1, @@ -313,13 +307,11 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1801ao", .ai_speed = 3000, - .ao_n_chan = 2, .range_ai = &range_ai_das1801, .has_wform_ao = 1, }, { .name = "das-1802ao", .ai_speed = 3000, - .ao_n_chan = 2, .range_ai = &range_ai_das1802, .has_wform_ao = 1, }, @@ -1287,7 +1279,7 @@ static int das1800_attach(struct comedi_device *dev, if (board->has_ao) { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->ao_n_chan; + s->n_chan = (board->has_4_ao_chan) ? 4 : 2; s->maxdata = (board->is_16bit) ? 0xffff : 0x0fff; s->range_table = &range_bipolar10; s->insn_write = das1800_ao_insn_write; -- 2.6.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel