summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-06-28 17:09:22 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-23 14:27:51 -0700
commit5c8a138e9d33df4960e3cb497c60723c7fbdacf9 (patch)
tree62ebab32f9a64668e1094f2bd9e86d90721ea998 /drivers
parentc6208c2f358056d77544024373e9d73dd899a384 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index ab1773e1fbcc..1f0f7f538215 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -871,25 +871,20 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
return ret;
}
-#ifdef CONFIG_ISA_DMA_API
- /* figure out what method we will use to transfer data */
- if (devpriv->dma_chan && /* need a dma channel allocated */
- /*
- * dma unsafe at RT priority,
- * and too much setup time for TRIG_WAKE_EOS for
- */
- (cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0) {
+ /* figure out what method we will use to transfer data */
+ if (labpc_have_dma_chan(dev) &&
+ /* dma unsafe at RT priority,
+ * and too much setup time for TRIG_WAKE_EOS */
+ (cmd->flags & (TRIG_WAKE_EOS | TRIG_RT)) == 0)
xfer = isa_dma_transfer;
- /* pc-plus has no fifo-half full interrupt */
- } else
-#endif
- if (board->is_labpc1200 &&
- /* wake-end-of-scan should interrupt on fifo not empty */
- (cmd->flags & TRIG_WAKE_EOS) == 0 &&
- /* make sure we are taking more than just a few points */
- (cmd->stop_src != TRIG_COUNT || devpriv->count > 256)) {
+ else if (/* pc-plus has no fifo-half full interrupt */
+ board->is_labpc1200 &&
+ /* wake-end-of-scan should interrupt on fifo not empty */
+ (cmd->flags & TRIG_WAKE_EOS) == 0 &&
+ /* make sure we are taking more than just a few points */
+ (cmd->stop_src != TRIG_COUNT || devpriv->count > 256))
xfer = fifo_half_full_transfer;
- } else
+ else
xfer = fifo_not_empty_transfer;
devpriv->current_transfer = xfer;