staging: comedi: ni_labpc: use labpc_have_dma_chan()

Call the new static inline function `labpc_have_dma_chan()` from
`labpc_ai_cmd()` to check if the ISA DMA channel has been initialized,
tidying up the surrounding code and removing an `#ifdef`.  If the
"ni_labpc_isadma" module is not being built, `labpc_have_dma_chan()`
doesn't bother checking the DMA channel and just returns `false`,
allowing the compiler to optimize out a small amount of code.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ian Abbott 2013-06-28 17:09:22 +01:00 committed by Greg Kroah-Hartman
parent c6208c2f35
commit 5c8a138e9d

View file

@ -871,25 +871,20 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return ret; return ret;
} }
#ifdef CONFIG_ISA_DMA_API /* figure out what method we will use to transfer data */
/* figure out what method we will use to transfer data */ if (labpc_have_dma_chan(dev) &&
if (devpriv->dma_chan && /* need a dma channel allocated */ /* dma unsafe at RT priority,
/* * and too much setup time for TRIG_WAKE_EOS */
* dma unsafe at RT priority, (cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0)
* and too much setup time for TRIG_WAKE_EOS for
*/
(cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0) {
xfer = isa_dma_transfer; xfer = isa_dma_transfer;
/* pc-plus has no fifo-half full interrupt */ else if (/* pc-plus has no fifo-half full interrupt */
} else board->is_labpc1200 &&
#endif /* wake-end-of-scan should interrupt on fifo not empty */
if (board->is_labpc1200 && (cmd->flags & TRIG_WAKE_EOS) == 0 &&
/* wake-end-of-scan should interrupt on fifo not empty */ /* make sure we are taking more than just a few points */
(cmd->flags & TRIG_WAKE_EOS) == 0 && (cmd->stop_src != TRIG_COUNT || devpriv->count > 256))
/* make sure we are taking more than just a few points */
(cmd->stop_src != TRIG_COUNT || devpriv->count > 256)) {
xfer = fifo_half_full_transfer; xfer = fifo_half_full_transfer;
} else else
xfer = fifo_not_empty_transfer; xfer = fifo_not_empty_transfer;
devpriv->current_transfer = xfer; devpriv->current_transfer = xfer;