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

staging: comedi: ni_mio_common: tidy up the Analog Input subdevice init

For aesthetics, add some whitespace to the Analog Input subdevice init.

The callers of ni_E_init() do the request_irq() and set dev->irq if the
interrupt is available. Only hook up the async command support if we
have the irq.

Also, remove the '#ifdef PCIDMA' here. The ni_pcimio driver is the only
place PCIDMA is defined. That driver is also the only user of ni_mio_common
that allocates devpriv->mite. Use that test instead to determine if the
subdevice async_dma_dir member needs to be initialized.
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 daabc8a6
......@@ -5503,36 +5503,37 @@ static int ni_E_init(struct comedi_device *dev,
if (ret)
return ret;
/* analog input subdevice */
/* Analog Input subdevice */
s = &dev->subdevices[NI_AI_SUBDEV];
dev->read_subdev = s;
if (board->n_adchan) {
s->type = COMEDI_SUBD_AI;
s->subdev_flags =
SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ;
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_DITHER;
if (!devpriv->is_611x)
s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER;
s->subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER;
if (board->ai_maxdata > 0xffff)
s->subdev_flags |= SDF_LSAMPL;
s->subdev_flags |= SDF_LSAMPL;
if (devpriv->is_m_series)
s->subdev_flags |= SDF_SOFT_CALIBRATED;
s->n_chan = board->n_adchan;
s->len_chanlist = 512;
s->maxdata = board->ai_maxdata;
s->range_table = ni_range_lkup[board->gainlkup];
s->insn_read = &ni_ai_insn_read;
s->insn_config = &ni_ai_insn_config;
s->do_cmdtest = &ni_ai_cmdtest;
s->do_cmd = &ni_ai_cmd;
s->cancel = &ni_ai_reset;
s->poll = &ni_ai_poll;
s->munge = &ni_ai_munge;
#ifdef PCIDMA
s->async_dma_dir = DMA_FROM_DEVICE;
#endif
s->subdev_flags |= SDF_SOFT_CALIBRATED;
s->n_chan = board->n_adchan;
s->maxdata = board->ai_maxdata;
s->range_table = ni_range_lkup[board->gainlkup];
s->insn_read = ni_ai_insn_read;
s->insn_config = ni_ai_insn_config;
if (dev->irq) {
dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ;
s->len_chanlist = 512;
s->do_cmdtest = ni_ai_cmdtest;
s->do_cmd = ni_ai_cmd;
s->cancel = ni_ai_reset;
s->poll = ni_ai_poll;
s->munge = ni_ai_munge;
if (devpriv->mite)
s->async_dma_dir = DMA_FROM_DEVICE;
}
} else {
s->type = COMEDI_SUBD_UNUSED;
s->type = COMEDI_SUBD_UNUSED;
}
/* analog output subdevice */
......
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