From: Heiner Kallweit <hkallweit1@gmail.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: [PATCH 1/2] mmc: core: add functions mmc_dma_(un)map_sg
Date: Mon, 27 Mar 2017 20:25:11 +0200 [thread overview]
Message-ID: <11e5aed4-c3ca-0d04-484a-9387302eaff2@gmail.com> (raw)
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
next reply other threads:[~2017-03-27 18:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-27 18:25 Heiner Kallweit [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11e5aed4-c3ca-0d04-484a-9387302eaff2@gmail.com \
--to=hkallweit1@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox