Commit a4b064ee authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: das1800: 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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6e89008b
...@@ -309,7 +309,7 @@ config COMEDI_DAS800 ...@@ -309,7 +309,7 @@ config COMEDI_DAS800
config COMEDI_DAS1800 config COMEDI_DAS1800
tristate "DAS1800 and compatible ISA card support" tristate "DAS1800 and compatible ISA card support"
depends on VIRT_TO_BUS && ISA_DMA_API depends on ISA_DMA_API
---help--- ---help---
Enable support for DAS1800 and compatible ISA cards Enable support for DAS1800 and compatible ISA cards
Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO, Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO,
......
...@@ -422,7 +422,8 @@ static const struct das1800_board das1800_boards[] = { ...@@ -422,7 +422,8 @@ static const struct das1800_board das1800_boards[] = {
struct das1800_dma_desc { struct das1800_dma_desc {
unsigned int chan; /* DMA channel */ unsigned int chan; /* DMA channel */
uint16_t *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 */
}; };
struct das1800_private { struct das1800_private {
...@@ -572,7 +573,7 @@ static void das1800_handle_dma(struct comedi_device *dev, ...@@ -572,7 +573,7 @@ static void das1800_handle_dma(struct comedi_device *dev,
flags = claim_dma_lock(); flags = claim_dma_lock();
das1800_flush_dma_channel(dev, s, dma->chan, dma->virt_addr); das1800_flush_dma_channel(dev, s, dma->chan, dma->virt_addr);
/* re-enable dma channel */ /* re-enable dma channel */
set_dma_addr(dma->chan, virt_to_bus(dma->virt_addr)); set_dma_addr(dma->chan, dma->hw_addr);
set_dma_count(dma->chan, devpriv->dma_transfer_size); set_dma_count(dma->chan, devpriv->dma_transfer_size);
enable_dma(dma->chan); enable_dma(dma->chan);
release_dma_lock(flags); release_dma_lock(flags);
...@@ -1013,7 +1014,7 @@ static void setup_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) ...@@ -1013,7 +1014,7 @@ static void setup_dma(struct comedi_device *dev, const struct comedi_cmd *cmd)
/* clear flip-flop to make sure 2-byte registers for /* clear flip-flop to make sure 2-byte registers for
* count and address get set correctly */ * count and address get set correctly */
clear_dma_ff(dma->chan); 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 appropriate size of transfer */ /* set appropriate size of transfer */
set_dma_count(dma->chan, devpriv->dma_transfer_size); set_dma_count(dma->chan, devpriv->dma_transfer_size);
enable_dma(dma->chan); enable_dma(dma->chan);
...@@ -1024,7 +1025,7 @@ static void setup_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) ...@@ -1024,7 +1025,7 @@ static void setup_dma(struct comedi_device *dev, const struct comedi_cmd *cmd)
/* clear flip-flop to make sure 2-byte registers for /* clear flip-flop to make sure 2-byte registers for
* count and address get set correctly */ * count and address get set correctly */
clear_dma_ff(dma->chan); 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 appropriate size of transfer */ /* set appropriate size of transfer */
set_dma_count(dma->chan, devpriv->dma_transfer_size); set_dma_count(dma->chan, devpriv->dma_transfer_size);
enable_dma(dma->chan); enable_dma(dma->chan);
...@@ -1288,7 +1289,8 @@ static int das1800_init_dma(struct comedi_device *dev, ...@@ -1288,7 +1289,8 @@ static int das1800_init_dma(struct comedi_device *dev,
} }
dma->chan = dma_chan[i]; dma->chan = dma_chan[i];
dma->virt_addr = kmalloc(DMA_BUF_SIZE, GFP_KERNEL | GFP_DMA); dma->virt_addr = dma_alloc_coherent(NULL, DMA_BUF_SIZE,
&dma->hw_addr, GFP_KERNEL);
if (!dma->virt_addr) if (!dma->virt_addr)
return -ENOMEM; return -ENOMEM;
...@@ -1520,7 +1522,9 @@ static void das1800_detach(struct comedi_device *dev) ...@@ -1520,7 +1522,9 @@ static void das1800_detach(struct comedi_device *dev)
dma = &devpriv->dma_desc[i]; dma = &devpriv->dma_desc[i];
if (dma->chan) if (dma->chan)
free_dma(dma->chan); free_dma(dma->chan);
kfree(dma->virt_addr); if (dma->virt_addr)
dma_free_coherent(NULL, DMA_BUF_SIZE,
dma->virt_addr, dma->hw_addr);
} }
kfree(devpriv->fifo_buf); kfree(devpriv->fifo_buf);
if (devpriv->iobase2) if (devpriv->iobase2)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment