From: H Hartley Sweeten Date: Mon, 17 Feb 2014 21:26:58 +0000 (-0700) Subject: staging: comedi: pcl812: all board types have analog inputs X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=78da4c5698110a77b5a9025ff3f03304990850e6;p=openwrt%2Fstaging%2Fblogic.git 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: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index 1d8366e97ebb..4909a106b2ce 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -1422,9 +1422,7 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->hwdmasize[1] = PAGE_SIZE * (1 << pages); } - n_subdevices = 0; - if (board->n_aichan > 0) - n_subdevices++; + n_subdevices = 1; /* all boardtypes have analog inputs */ if (board->n_aochan > 0) n_subdevices++; if (board->has_dio) @@ -1436,59 +1434,59 @@ static int pcl812_attach(struct comedi_device *dev, struct comedi_devconfig *it) subdev = 0; - /* analog input */ - if (board->n_aichan > 0) { - s = &dev->subdevices[subdev]; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE; - switch (board->board_type) { - case boardA821: - if (it->options[2] == 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; - 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; + /* Analog Input subdevice */ + s = &dev->subdevices[subdev]; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE; + switch (board->board_type) { + case boardA821: + if (it->options[2] == 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; } - 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; - - devpriv->use_MPC = board->has_mpc508_mux; - 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; + 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; } - 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 */ if (board->n_aochan > 0) {