staging: comedi: dt282x: remove VIRT_TO_BUS dependancy
Use dma_{alloc,free}_coherent() to allocate and free the DMA buffers. This removes the dependancy on VIRT_TO_BUS. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
eca331c20f
commit
ef98a104c2
|
@ -372,7 +372,7 @@ config COMEDI_DT2817
|
|||
|
||||
config COMEDI_DT282X
|
||||
tristate "Data Translation DT2821 series and DT-EZ ISA card support"
|
||||
depends on VIRT_TO_BUS && ISA_DMA_API
|
||||
depends on ISA_DMA_API
|
||||
---help---
|
||||
Enable support for Data Translation DT2821 series including DT-EZ
|
||||
DT2821, DT2821-F-16SE, DT2821-F-8DI, DT2821-G-16SE, DT2821-G-8DI,
|
||||
|
|
|
@ -302,7 +302,8 @@ static const struct dt282x_board boardtypes[] = {
|
|||
|
||||
struct dt282x_dma_desc {
|
||||
unsigned int chan; /* DMA channel */
|
||||
unsigned short *virt_addr; /* virtual address of DMA buffer */
|
||||
void *virt_addr; /* virtual address of DMA buffer */
|
||||
dma_addr_t hw_addr; /* hardware (bus) address of DMA buffer */
|
||||
unsigned int size; /* transfer size (in bytes) */
|
||||
};
|
||||
|
||||
|
@ -344,7 +345,7 @@ static int dt282x_prep_ai_dma(struct comedi_device *dev, int dma_index, int n)
|
|||
set_dma_mode(dma->chan, DMA_MODE_READ);
|
||||
flags = claim_dma_lock();
|
||||
clear_dma_ff(dma->chan);
|
||||
set_dma_addr(dma->chan, virt_to_bus(dma->virt_addr));
|
||||
set_dma_addr(dma->chan, dma->hw_addr);
|
||||
set_dma_count(dma->chan, dma->size);
|
||||
release_dma_lock(flags);
|
||||
|
||||
|
@ -364,7 +365,7 @@ static int dt282x_prep_ao_dma(struct comedi_device *dev, int dma_index, int n)
|
|||
set_dma_mode(dma->chan, DMA_MODE_WRITE);
|
||||
flags = claim_dma_lock();
|
||||
clear_dma_ff(dma->chan);
|
||||
set_dma_addr(dma->chan, virt_to_bus(dma->virt_addr));
|
||||
set_dma_addr(dma->chan, dma->hw_addr);
|
||||
set_dma_count(dma->chan, dma->size);
|
||||
release_dma_lock(flags);
|
||||
|
||||
|
@ -1087,7 +1088,8 @@ static int dt282x_alloc_dma(struct comedi_device *dev,
|
|||
struct dt282x_dma_desc *dma = &devpriv->dma_desc[i];
|
||||
|
||||
dma->chan = dma_chan[i];
|
||||
dma->virt_addr = (void *)__get_free_page(GFP_KERNEL | GFP_DMA);
|
||||
dma->virt_addr = dma_alloc_coherent(NULL, devpriv->dma_maxsize,
|
||||
&dma->hw_addr, GFP_KERNEL);
|
||||
if (!dma->virt_addr)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -1109,7 +1111,8 @@ static void dt282x_free_dma(struct comedi_device *dev)
|
|||
if (dma->chan)
|
||||
free_dma(dma->chan);
|
||||
if (dma->virt_addr)
|
||||
free_page((unsigned long)dma->virt_addr);
|
||||
dma_free_coherent(NULL, devpriv->dma_maxsize,
|
||||
dma->virt_addr, dma->hw_addr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue