Skip to content

Commit

Permalink
staging: comedi: me4000: remove struct me4000_dio_info
Browse files Browse the repository at this point in the history
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 <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Sep 8, 2012
1 parent eedf429 commit 898f519
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 46 deletions.
56 changes: 15 additions & 41 deletions drivers/staging/comedi/drivers/me4000.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,15 @@ static const struct me4000_board me4000_boards[] = {
.ai = {
.count = 16,
},
.dio = {
.count = 4,
},
.dio_nchan = 32,
}, {
.name = "ME-4660",
.device_id = 0x4660,
.ai = {
.count = 32,
.diff_count = 16,
},
.dio = {
.count = 4,
},
.dio_nchan = 32,
.has_counter = 1,
}, {
.name = "ME-4660i",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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,
},
};
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions drivers/staging/comedi/drivers/me4000.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down

0 comments on commit 898f519

Please sign in to comment.