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

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

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

Also, remove the '#ifdef PCIDMA' here and only hook up the async command
support if we have an irq and the board either has a fifo or DMA is
supported.

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 dma is supported.

Move 'is_67xx' check and init_ao_67xx() call into the Analog Output
subdevice init. The 67xx boards all have analog outputs and this check
does not need to be done for the boards that do not have analog outputs.
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 a06500b4
...@@ -5536,8 +5536,7 @@ static int ni_E_init(struct comedi_device *dev, ...@@ -5536,8 +5536,7 @@ static int ni_E_init(struct comedi_device *dev,
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
/* analog output subdevice */ /* Analog Output subdevice */
s = &dev->subdevices[NI_AO_SUBDEV]; s = &dev->subdevices[NI_AO_SUBDEV];
if (board->n_aochan) { if (board->n_aochan) {
s->type = COMEDI_SUBD_AO; s->type = COMEDI_SUBD_AO;
...@@ -5547,29 +5546,33 @@ static int ni_E_init(struct comedi_device *dev, ...@@ -5547,29 +5546,33 @@ static int ni_E_init(struct comedi_device *dev,
s->n_chan = board->n_aochan; s->n_chan = board->n_aochan;
s->maxdata = board->ao_maxdata; s->maxdata = board->ao_maxdata;
s->range_table = board->ao_range_table; s->range_table = board->ao_range_table;
s->insn_read = &ni_ao_insn_read; s->insn_read = ni_ao_insn_read;
s->insn_write = &ni_ao_insn_write; s->insn_write = ni_ao_insn_write;
s->insn_config = &ni_ao_insn_config; s->insn_config = ni_ao_insn_config;
#ifdef PCIDMA
if (board->n_aochan) { /*
s->async_dma_dir = DMA_TO_DEVICE; * Along with the IRQ we need either a FIFO or DMA for
#else * async command support.
if (board->ao_fifo_depth) { */
#endif if (dev->irq && (board->ao_fifo_depth || devpriv->mite)) {
dev->write_subdev = s; dev->write_subdev = s;
s->subdev_flags |= SDF_CMD_WRITE; s->subdev_flags |= SDF_CMD_WRITE;
s->do_cmd = &ni_ao_cmd; s->len_chanlist = s->n_chan;
s->do_cmdtest = &ni_ao_cmdtest; s->do_cmdtest = ni_ao_cmdtest;
s->cancel = &ni_ao_reset; s->do_cmd = ni_ao_cmd;
s->len_chanlist = board->n_aochan; s->cancel = ni_ao_reset;
if (!devpriv->is_m_series) if (!devpriv->is_m_series)
s->munge = ni_ao_munge; s->munge = ni_ao_munge;
if (devpriv->mite)
s->async_dma_dir = DMA_TO_DEVICE;
} }
if (devpriv->is_67xx)
init_ao_67xx(dev, s);
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
} }
if (devpriv->is_67xx)
init_ao_67xx(dev, s);
/* digital i/o subdevice */ /* digital i/o 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