public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg
@ 2017-03-27 18:25 Heiner Kallweit
  2017-03-27 18:29 ` [PATCH 2/2] mmc: use new functions mmc_dma_(un)map_sg in host drivers Heiner Kallweit
  2017-03-28  7:18 ` [PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2017-03-27 18:25 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc@vger.kernel.org

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-28  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-27 18:25 [PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg Heiner Kallweit
2017-03-27 18:29 ` [PATCH 2/2] mmc: use new functions mmc_dma_(un)map_sg in host drivers Heiner Kallweit
2017-03-28  9:53   ` kbuild test robot
2017-03-28  7:18 ` [PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox