summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2015-01-12 10:56:08 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-01-17 14:25:21 -0800
commit9fe11ffeb1db5cd589931c5bc529b4d040def643 (patch)
treeff8177372494f0290bd446acd335e42bce05ef20
parentd8332a68976fc58ef79284548636f86b3f1c124e (diff)
staging: comedi: pcl812: 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>
-rw-r--r--drivers/staging/comedi/Kconfig2
-rw-r--r--drivers/staging/comedi/drivers/pcl812.c20
2 files changed, 10 insertions, 12 deletions
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index 59c17e60b0be..4441600057e0 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -168,7 +168,7 @@ config COMEDI_PCL730
config COMEDI_PCL812
tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216"
- depends on VIRT_TO_BUS && ISA_DMA_API
+ depends on ISA_DMA_API
---help---
Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink
ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA,
diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c
index d9f94c982916..2c2e7dd9d3a1 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -507,8 +507,8 @@ static const struct pcl812_board boardtypes[] = {
};
struct pcl812_dma_desc {
- unsigned long virt_addr; /* virtual address of DMA buffer */
- unsigned int 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; /* transfer size (in bytes) */
};
@@ -518,7 +518,6 @@ struct pcl812_private {
unsigned int last_ai_chanspec;
unsigned char mode_reg_int; /* there is stored INT number for some card */
unsigned int ai_poll_ptr; /* how many sampes transfer poll */
- unsigned int dmapages;
unsigned int hwdmasize;
struct pcl812_dma_desc dma_desc[2];
int cur_dma;
@@ -905,7 +904,7 @@ static void pcl812_handle_dma(struct comedi_device *dev,
bufptr = devpriv->ai_poll_ptr;
devpriv->ai_poll_ptr = 0;
- transfer_from_dma_buf(dev, s, (void *)dma->virt_addr, bufptr, nsamples);
+ transfer_from_dma_buf(dev, s, dma->virt_addr, bufptr, nsamples);
}
static irqreturn_t pcl812_interrupt(int irq, void *d)
@@ -964,7 +963,7 @@ static int pcl812_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
return 0;
}
- transfer_from_dma_buf(dev, s, (void *)dma->virt_addr,
+ transfer_from_dma_buf(dev, s, dma->virt_addr,
devpriv->ai_poll_ptr, top2);
devpriv->ai_poll_ptr = top1; /* new buffer position */
@@ -1203,17 +1202,15 @@ static int pcl812_alloc_dma(struct comedi_device *dev, unsigned int dma_chan)
return 0;
devpriv->dma = dma_chan;
- devpriv->dmapages = 1; /* we want 8KB */
- devpriv->hwdmasize = (1 << devpriv->dmapages) * PAGE_SIZE;
+ devpriv->hwdmasize = PAGE_SIZE * 2; /* we want 8KB */
for (i = 0; i < 2; i++) {
dma = &devpriv->dma_desc[i];
- dma->virt_addr = __get_dma_pages(GFP_KERNEL, devpriv->dmapages);
+ dma->virt_addr = dma_alloc_coherent(NULL, devpriv->hwdmasize,
+ &dma->hw_addr, GFP_KERNEL);
if (!dma->virt_addr)
return -ENOMEM;
-
- dma->hw_addr = virt_to_bus((void *)dma->virt_addr);
}
return 0;
}
@@ -1230,7 +1227,8 @@ static void pcl812_free_dma(struct comedi_device *dev)
for (i = 0; i < 2; i++) {
dma = &devpriv->dma_desc[i];
if (dma->virt_addr)
- free_pages(dma->virt_addr, devpriv->dmapages);
+ dma_free_coherent(NULL, devpriv->hwdmasize,
+ dma->virt_addr, dma->hw_addr);
}
if (devpriv->dma)
free_dma(devpriv->dma);