Commit 78da4c56 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl812: all board types have analog inputs

All the boards supported by this driver have 16 or 32 analog input
channels.

Remove the unnecessary check in pcl812_attach() to reduce the indent
level of the code.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f39b8ccf
...@@ -1422,9 +1422,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1422,9 +1422,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->hwdmasize[1] = PAGE_SIZE * (1 << pages); devpriv->hwdmasize[1] = PAGE_SIZE * (1 << pages);
} }
n_subdevices = 0; n_subdevices = 1; /* all boardtypes have analog inputs */
if (board->n_aichan > 0)
n_subdevices++;
if (board->n_aochan > 0) if (board->n_aochan > 0)
n_subdevices++; n_subdevices++;
if (board->has_dio) if (board->has_dio)
...@@ -1436,59 +1434,59 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1436,59 +1434,59 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
subdev = 0; subdev = 0;
/* analog input */ /* Analog Input subdevice */
if (board->n_aichan > 0) { s = &dev->subdevices[subdev];
s = &dev->subdevices[subdev]; s->type = COMEDI_SUBD_AI;
s->type = COMEDI_SUBD_AI; s->subdev_flags = SDF_READABLE;
s->subdev_flags = SDF_READABLE; switch (board->board_type) {
switch (board->board_type) { case boardA821:
case boardA821: if (it->options[2] == 1) {
if (it->options[2] == 1) { s->n_chan = board->n_aichan_diff;
s->n_chan = board->n_aichan_diff; s->subdev_flags |= SDF_DIFF;
s->subdev_flags |= SDF_DIFF; devpriv->use_diff = 1;
devpriv->use_diff = 1; } else {
} else { s->n_chan = board->n_aichan;
s->n_chan = board->n_aichan; s->subdev_flags |= SDF_GROUND;
s->subdev_flags |= SDF_GROUND;
}
break;
case boardACL8112:
case boardACL8216:
if (it->options[4] == 1) {
s->n_chan = board->n_aichan_diff;
s->subdev_flags |= SDF_DIFF;
devpriv->use_diff = 1;
} else {
s->n_chan = board->n_aichan;
s->subdev_flags |= SDF_GROUND;
}
break;
default:
s->n_chan = board->n_aichan;
s->subdev_flags |= SDF_GROUND;
break;
} }
s->maxdata = board->ai_maxdata; break;
case boardACL8112:
pcl812_set_ai_range_table(dev, s, it); case boardACL8216:
if (it->options[4] == 1) {
if (board->board_type == boardACL8216) s->n_chan = board->n_aichan_diff;
s->insn_read = acl8216_ai_insn_read; s->subdev_flags |= SDF_DIFF;
else devpriv->use_diff = 1;
s->insn_read = pcl812_ai_insn_read; } else {
s->n_chan = board->n_aichan;
devpriv->use_MPC = board->has_mpc508_mux; s->subdev_flags |= SDF_GROUND;
if (dev->irq) {
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = MAX_CHANLIST_LEN;
s->do_cmdtest = pcl812_ai_cmdtest;
s->do_cmd = pcl812_ai_cmd;
s->poll = pcl812_ai_poll;
s->cancel = pcl812_ai_cancel;
} }
subdev++; break;
default:
s->n_chan = board->n_aichan;
s->subdev_flags |= SDF_GROUND;
break;
} }
s->maxdata = board->ai_maxdata;
pcl812_set_ai_range_table(dev, s, it);
if (board->board_type == boardACL8216)
s->insn_read = acl8216_ai_insn_read;
else
s->insn_read = pcl812_ai_insn_read;
if (dev->irq) {
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = MAX_CHANLIST_LEN;
s->do_cmdtest = pcl812_ai_cmdtest;
s->do_cmd = pcl812_ai_cmd;
s->poll = pcl812_ai_poll;
s->cancel = pcl812_ai_cancel;
}
devpriv->use_MPC = board->has_mpc508_mux;
subdev++;
/* analog output */ /* analog output */
if (board->n_aochan > 0) { if (board->n_aochan > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment