]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: ni_labpc: remove VIRT_TO_BUS dependancy
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 12 Jan 2015 17:55:54 +0000 (10:55 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 17 Jan 2015 22:25:20 +0000 (14:25 -0800)
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>
drivers/staging/comedi/Kconfig
drivers/staging/comedi/drivers/ni_labpc.h
drivers/staging/comedi/drivers/ni_labpc_isadma.c

index 982b03f79b36cb4ad504aed2cec7d04d00ca62ab..76d66e02159e96ae3af5450f8f325e4a18058e39 100644 (file)
@@ -502,7 +502,7 @@ config COMEDI_NI_ATMIO16D
 config COMEDI_NI_LABPC_ISA
        tristate "NI Lab-PC and compatibles ISA support"
        select COMEDI_NI_LABPC
-       select COMEDI_NI_LABPC_ISADMA if ISA_DMA_API && VIRT_TO_BUS
+       select COMEDI_NI_LABPC_ISADMA if ISA_DMA_API
        ---help---
          Enable support for National Instruments Lab-PC and compatibles
          Lab-PC-1200, Lab-PC-1200AI, Lab-PC+.
index 7ba7f2ffa41edd1c12eff6f8865d64797c211e67..c26d7ee16071a90683acdfedc001bdf992395c3f 100644 (file)
@@ -36,8 +36,8 @@ struct labpc_boardinfo {
 
 struct labpc_dma_desc {
        unsigned int chan;      /* DMA channel */
-       u16 *virt_addr;         /* virtual address of DMA buffer */
-       phys_addr_t hw_addr;    /* hardware (bus) 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;      /* size of DMA transfer (in bytes) */
 };
 
index 829c4e447912780ff1674d06df609b9ba8ba962c..ecdbe11a206c49519789d5e22661930b567fec74 100644 (file)
@@ -175,14 +175,14 @@ void labpc_init_dma_chan(struct comedi_device *dev, unsigned int dma_chan)
        if (request_dma(dma_chan, dev->board_name))
                return;
 
-       dma->virt_addr = kmalloc(dma_buffer_size, GFP_KERNEL | GFP_DMA);
+       dma->virt_addr = dma_alloc_coherent(NULL, dma_buffer_size,
+                                           &dma->hw_addr, GFP_KERNEL);
        if (!dma->virt_addr) {
                free_dma(dma_chan);
                return;
        }
 
        dma->chan = dma_chan;
-       dma->hw_addr = virt_to_bus(dma->virt_addr);
 
        dma_flags = claim_dma_lock();
        disable_dma(dma->chan);
@@ -196,7 +196,9 @@ void labpc_free_dma_chan(struct comedi_device *dev)
        struct labpc_private *devpriv = dev->private;
        struct labpc_dma_desc *dma = &devpriv->dma_desc;
 
-       kfree(dma->virt_addr);
+       if (dma->virt_addr)
+               dma_free_coherent(NULL, dma_buffer_size,
+                                 dma->virt_addr, dma->hw_addr);
        if (dma->chan)
                free_dma(dma->chan);
 }