提交 19a40abf 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: ni_labpc: allow board to attach without dma

If the dma channel is not available this driver will still work
with interrupts for the analog input subdevice command support.

In addition, only dma channels 1 and 3 are valid for the ISA
devices.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 0229979a
...@@ -1673,30 +1673,23 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase, ...@@ -1673,30 +1673,23 @@ int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
} }
#ifdef CONFIG_ISA_DMA_API #ifdef CONFIG_ISA_DMA_API
/* grab dma channel */ if (dma_chan == 1 || dma_chan == 3) {
if (dma_chan > 3) {
dev_err(dev->class_dev, "invalid dma channel %u\n", dma_chan);
return -EINVAL;
} else if (dma_chan) {
unsigned long dma_flags;
/* allocate dma buffer */
devpriv->dma_buffer = kmalloc(dma_buffer_size, devpriv->dma_buffer = kmalloc(dma_buffer_size,
GFP_KERNEL | GFP_DMA); GFP_KERNEL | GFP_DMA);
if (devpriv->dma_buffer == NULL) if (devpriv->dma_buffer) {
return -ENOMEM; ret = request_dma(dma_chan, dev->board_name);
if (ret == 0) {
if (request_dma(dma_chan, dev->board_name)) { unsigned long dma_flags;
dev_err(dev->class_dev,
"failed to allocate dma channel %u\n", devpriv->dma_chan = dma_chan;
dma_chan); dma_flags = claim_dma_lock();
return -EINVAL; disable_dma(devpriv->dma_chan);
set_dma_mode(devpriv->dma_chan, DMA_MODE_READ);
release_dma_lock(dma_flags);
} else {
kfree(devpriv->dma_buffer);
}
} }
devpriv->dma_chan = dma_chan;
dma_flags = claim_dma_lock();
disable_dma(devpriv->dma_chan);
set_dma_mode(devpriv->dma_chan, DMA_MODE_READ);
release_dma_lock(dma_flags);
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册