[PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg

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

 



After the recent introduction of mmc_get_dma_dir next step is to
factor out the typical usage of dma_(un)map_sg to the core.
Several host drivers use dma_(un)map_sg with these parameters:
data->sg, data->sg_len, mmc_get_dma_dir(data)
Therefore factor this out to the core and introduce
mmc_dma_(un)map_sg.

Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
 include/linux/mmc/host.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 21385ac0..8d28a600 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -17,7 +17,7 @@
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/pm.h>
-#include <linux/dma-direction.h>
+#include <linux/dma-mapping.h>
 
 struct mmc_ios {
 	unsigned int	clock;			/* clock rate */
@@ -505,6 +505,16 @@ static inline enum dma_data_direction mmc_get_dma_dir(struct mmc_data *data)
 	return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
 }
 
+static inline int mmc_dma_map_sg(struct device *dev, struct mmc_data *data)
+{
+	return dma_map_sg(dev, data->sg, data->sg_len, mmc_get_dma_dir(data));
+}
+
+static inline void mmc_dma_unmap_sg(struct device *dev, struct mmc_data *data)
+{
+	dma_unmap_sg(dev, data->sg, data->sg_len, mmc_get_dma_dir(data));
+}
+
 int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
 int mmc_abort_tuning(struct mmc_host *host, u32 opcode);
 
-- 
2.12.1

--
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