[PATCH 1/3] mmc: tmio: fix for platforms, where CONFIG_ZONE_DMA is not defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On platforms, not defining CONFIG_ZONE_DMA, GFP_DMA cannot be used,
switch to using the dma_alloc_coherent() / dma_free_coherent() API.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@xxxxxx>
---
 drivers/mmc/host/tmio_mmc.h     |    2 ++
 drivers/mmc/host/tmio_mmc_dma.c |    7 +++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 8260bc2..f105006 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -20,6 +20,7 @@
 #include <linux/mmc/tmio.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
+#include <linux/types.h>
 
 /* Definitions for values the CTRL_SDIO_STATUS register can take. */
 #define TMIO_SDIO_STAT_IOIRQ	0x0001
@@ -70,6 +71,7 @@ struct tmio_mmc_host {
 	struct tasklet_struct	dma_issue;
 	struct scatterlist	bounce_sg;
 	u8			*bounce_buf;
+	dma_addr_t		bounce_dma;
 
 	/* Track lost interrupts */
 	struct delayed_work	delayed_reset_work;
diff --git a/drivers/mmc/host/tmio_mmc_dma.c b/drivers/mmc/host/tmio_mmc_dma.c
index 25f1ad6..7fed4c3 100644
--- a/drivers/mmc/host/tmio_mmc_dma.c
+++ b/drivers/mmc/host/tmio_mmc_dma.c
@@ -11,6 +11,7 @@
  */
 
 #include <linux/device.h>
+#include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
@@ -281,7 +282,8 @@ void tmio_mmc_request_dma(struct tmio_mmc_host *host, struct tmio_mmc_data *pdat
 		if (!host->chan_rx)
 			goto ereqrx;
 
-		host->bounce_buf = (u8 *)__get_free_page(GFP_KERNEL | GFP_DMA);
+		host->bounce_buf = dma_alloc_coherent(&host->pdev->dev,
+					PAGE_SIZE, &host->bounce_dma, GFP_KERNEL);
 		if (!host->bounce_buf)
 			goto ebouncebuf;
 
@@ -314,7 +316,8 @@ void tmio_mmc_release_dma(struct tmio_mmc_host *host)
 		dma_release_channel(chan);
 	}
 	if (host->bounce_buf) {
-		free_pages((unsigned long)host->bounce_buf, 0);
+		dma_free_coherent(&host->pdev->dev, PAGE_SIZE,
+				  host->bounce_buf, host->bounce_dma);
 		host->bounce_buf = NULL;
 	}
 }
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux