From 898f51910d38053eb12e0adc7c04119e6ad8ac6e Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Fri, 7 Sep 2012 17:39:50 -0700 Subject: [PATCH] staging: comedi: me4000: remove struct me4000_dio_info The me4000_dio_info in the boardinfo struct is used to indicate the number of 8 bit dio ports the the board has. Add a 'dio_nchan' field to struct me4000_board and remove the struct me4000_dio_info. The 'dio_nchan' value can then be used directly in the attach of the board when setting the subdevice number of channels. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/me4000.c | 56 +++++++++------------------------ drivers/staging/comedi/drivers/me4000.h | 6 +--- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c index 492b47e..8ca0230 100644 --- a/drivers/staging/comedi/drivers/me4000.c +++ b/drivers/staging/comedi/drivers/me4000.c @@ -71,9 +71,7 @@ static const struct me4000_board me4000_boards[] = { .ai = { .count = 16, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, }, { .name = "ME-4660", .device_id = 0x4660, @@ -81,9 +79,7 @@ static const struct me4000_board me4000_boards[] = { .count = 32, .diff_count = 16, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4660i", @@ -92,9 +88,7 @@ static const struct me4000_board me4000_boards[] = { .count = 32, .diff_count = 16, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4660s", @@ -104,9 +98,7 @@ static const struct me4000_board me4000_boards[] = { .sh_count = 8, .diff_count = 16, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4660is", @@ -116,9 +108,7 @@ static const struct me4000_board me4000_boards[] = { .sh_count = 8, .diff_count = 16, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4670", @@ -131,9 +121,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4670i", @@ -146,9 +134,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4670s", @@ -162,9 +148,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4670is", @@ -178,9 +162,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4680", @@ -194,9 +176,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4680i", @@ -210,9 +190,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4680s", @@ -227,9 +205,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, { .name = "ME-4680is", @@ -244,9 +220,7 @@ static const struct me4000_board me4000_boards[] = { .diff_count = 16, .ex_trig_analog = 1, }, - .dio = { - .count = 4, - }, + .dio_nchan = 32, .has_counter = 1, }, }; @@ -2239,10 +2213,10 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it) s = &dev->subdevices[2]; - if (thisboard->dio.count) { + if (thisboard->dio_nchan) { s->type = COMEDI_SUBD_DIO; s->subdev_flags = SDF_READABLE | SDF_WRITABLE; - s->n_chan = thisboard->dio.count * 8; + s->n_chan = thisboard->dio_nchan; s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = me4000_dio_insn_bits; diff --git a/drivers/staging/comedi/drivers/me4000.h b/drivers/staging/comedi/drivers/me4000.h index 2b609d7..12b5c1f 100644 --- a/drivers/staging/comedi/drivers/me4000.h +++ b/drivers/staging/comedi/drivers/me4000.h @@ -268,16 +268,12 @@ struct me4000_ai_info { int ex_trig_analog; }; -struct me4000_dio_info { - int count; -}; - struct me4000_board { const char *name; unsigned short device_id; struct me4000_ao_info ao; struct me4000_ai_info ai; - struct me4000_dio_info dio; + int dio_nchan; int has_counter; }; -- 2.7.4