The "hc" type boards have 8 digtial outputs. All other board types have 4. Replace the 'do_n_chan' member of the boardinfo with a bit-field flag, 'has_8_do_chan', and only set it for the "hc" type boards. Remove the unnecessary initialization for all other board types. 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 | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 6067b57..ed58ebb 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 do_n_chan; /* number of digital output channels */ int ao_ability; /* 0 == no analog out, 1 == basic analog out, 2 == waveform analog out */ 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_8_do_chan:1; }; /* Warning: the maximum conversion speeds listed below are @@ -220,37 +220,31 @@ static const struct das1800_board das1800_boards[] = { { .name = "das-1701st", .ai_speed = 6250, - .do_n_chan = 4, .range_ai = &range_ai_das1801, }, { .name = "das-1701st-da", .ai_speed = 6250, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 4, .range_ai = &range_ai_das1801, }, { .name = "das-1702st", .ai_speed = 6250, - .do_n_chan = 4, .range_ai = &range_ai_das1802, }, { .name = "das-1702st-da", .ai_speed = 6250, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 4, .range_ai = &range_ai_das1802, }, { .name = "das-1702hr", .ai_speed = 20000, - .do_n_chan = 4, .range_ai = &range_ai_das1802, .is_16bit = 1, }, { .name = "das-1702hr-da", .ai_speed = 20000, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 2, .range_ai = &range_ai_das1802, @@ -258,51 +252,43 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1701ao", .ai_speed = 6250, - .do_n_chan = 4, .ao_ability = 2, .ao_n_chan = 2, .range_ai = &range_ai_das1801, }, { .name = "das-1702ao", .ai_speed = 6250, - .do_n_chan = 4, .ao_ability = 2, .ao_n_chan = 2, .range_ai = &range_ai_das1802, }, { .name = "das-1801st", .ai_speed = 3000, - .do_n_chan = 4, .range_ai = &range_ai_das1801, }, { .name = "das-1801st-da", .ai_speed = 3000, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 4, .range_ai = &range_ai_das1801, }, { .name = "das-1802st", .ai_speed = 3000, - .do_n_chan = 4, .range_ai = &range_ai_das1802, }, { .name = "das-1802st-da", .ai_speed = 3000, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 4, .range_ai = &range_ai_das1802, }, { .name = "das-1802hr", .ai_speed = 10000, - .do_n_chan = 4, .range_ai = &range_ai_das1802, .is_16bit = 1, }, { .name = "das-1802hr-da", .ai_speed = 10000, - .do_n_chan = 4, .ao_ability = 1, .ao_n_chan = 2, .range_ai = &range_ai_das1802, @@ -310,30 +296,28 @@ static const struct das1800_board das1800_boards[] = { }, { .name = "das-1801hc", .ai_speed = 3000, - .do_n_chan = 8, .ao_ability = 1, .ao_n_chan = 2, .range_ai = &range_ai_das1801, .has_64_ai_chan = 1, + .has_8_do_chan = 1, }, { .name = "das-1802hc", .ai_speed = 3000, - .do_n_chan = 8, .ao_ability = 1, .ao_n_chan = 2, .range_ai = &range_ai_das1802, .has_64_ai_chan = 1, + .has_8_do_chan = 1, }, { .name = "das-1801ao", .ai_speed = 3000, - .do_n_chan = 4, .ao_ability = 2, .ao_n_chan = 2, .range_ai = &range_ai_das1801, }, { .name = "das-1802ao", .ai_speed = 3000, - .do_n_chan = 4, .ao_ability = 2, .ao_n_chan = 2, .range_ai = &range_ai_das1802, @@ -1322,7 +1306,7 @@ static int das1800_attach(struct comedi_device *dev, s = &dev->subdevices[3]; s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = board->do_n_chan; + s->n_chan = (board->has_8_do_chan) ? 8 : 4; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = das1800_do_insn_bits; -- 2.6.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel