public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@arm.linux.org.uk>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Gregory CLEMENT <gregory.clement@free-electrons.com>,
	linux-mmc@vger.kernel.org, Marcin Wojtas <mw@semihalf.com>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>
Subject: [PATCH v4 13/25] mmc: sdhci: move sdhci_pre_dma_transfer()
Date: Fri, 29 Jan 2016 09:44:52 +0000	[thread overview]
Message-ID: <E1aP5bo-0001pn-N0@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20160129094324.GA20025@n2100.arm.linux.org.uk>

Move sdhci_pre_dma_transfer() to avoid needing to declare this function
before use.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 drivers/mmc/host/sdhci.c | 52 +++++++++++++++++++++++-------------------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 49692b7b4016..260b1caeced8 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -53,8 +53,6 @@ static void sdhci_finish_data(struct sdhci_host *);
 static void sdhci_finish_command(struct sdhci_host *);
 static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode);
 static void sdhci_enable_preset_value(struct sdhci_host *host, bool enable);
-static int sdhci_pre_dma_transfer(struct sdhci_host *host,
-					struct mmc_data *data);
 static int sdhci_do_get_cd(struct sdhci_host *host);
 
 #ifdef CONFIG_PM
@@ -428,6 +426,31 @@ static void sdhci_transfer_pio(struct sdhci_host *host)
 	DBG("PIO transfer complete.\n");
 }
 
+static int sdhci_pre_dma_transfer(struct sdhci_host *host,
+				  struct mmc_data *data)
+{
+	int sg_count;
+
+	if (data->host_cookie == COOKIE_MAPPED) {
+		data->host_cookie = COOKIE_GIVEN;
+		return data->sg_count;
+	}
+
+	WARN_ON(data->host_cookie == COOKIE_GIVEN);
+
+	sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
+				data->flags & MMC_DATA_WRITE ?
+				DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+	if (sg_count == 0)
+		return -ENOSPC;
+
+	data->sg_count = sg_count;
+	data->host_cookie = COOKIE_MAPPED;
+
+	return sg_count;
+}
+
 static char *sdhci_kmap_atomic(struct scatterlist *sg, unsigned long *flags)
 {
 	local_irq_save(*flags);
@@ -2070,31 +2093,6 @@ static void sdhci_post_req(struct mmc_host *mmc, struct mmc_request *mrq,
 	}
 }
 
-static int sdhci_pre_dma_transfer(struct sdhci_host *host,
-				       struct mmc_data *data)
-{
-	int sg_count;
-
-	if (data->host_cookie == COOKIE_MAPPED) {
-		data->host_cookie = COOKIE_GIVEN;
-		return data->sg_count;
-	}
-
-	WARN_ON(data->host_cookie == COOKIE_GIVEN);
-
-	sg_count = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
-				data->flags & MMC_DATA_WRITE ?
-				DMA_TO_DEVICE : DMA_FROM_DEVICE);
-
-	if (sg_count == 0)
-		return -ENOSPC;
-
-	data->sg_count = sg_count;
-	data->host_cookie = COOKIE_MAPPED;
-
-	return sg_count;
-}
-
 static void sdhci_pre_req(struct mmc_host *mmc, struct mmc_request *mrq,
 			       bool is_first_req)
 {
-- 
2.1.0


  parent reply	other threads:[~2016-01-29  9:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29  9:43 [PATCH v4 00/25] MMC/SDHCI fixes Russell King - ARM Linux
2016-01-29  9:43 ` [PATCH v4 01/25] mmc: core: shut up "voltage-ranges unspecified" pr_info() Russell King
2016-01-29  9:43 ` [PATCH v4 02/25] mmc: core: improve mmc_of_parse_voltage() to return better status Russell King
2016-01-29  9:44 ` [PATCH v4 03/25] mmc: block: shut up "retrying because a re-tune was needed" message Russell King
2016-01-29  9:44 ` [PATCH v4 04/25] mmc: core: report tuning command execution failure reason Russell King
2016-01-29  9:44 ` [PATCH v4 05/25] mmc: sdhci: move initialisation of command error member Russell King
2016-01-29  9:44 ` [PATCH v4 06/25] mmc: sdhci: clean up command error handling Russell King
2016-01-29  9:44 ` [PATCH v4 07/25] mmc: sdhci: command response CRC " Russell King
2016-01-29  9:44 ` [PATCH v4 08/25] mmc: sdhci: avoid unnecessary mapping/unmapping of align buffer Russell King
2016-01-29  9:44 ` [PATCH v4 09/25] mmc: sdhci: allocate alignment and DMA descriptor buffer together Russell King
2016-01-29  9:44 ` [PATCH v4 10/25] mmc: sdhci: clean up coding style in sdhci_adma_table_pre() Russell King
2016-01-29  9:44 ` [PATCH v4 11/25] mmc: sdhci: avoid walking SG list for writes Russell King
2016-01-29  9:44 ` [PATCH v4 12/25] mmc: sdhci: factor out common DMA cleanup in sdhci_finish_data() Russell King
2016-01-29  9:44 ` Russell King [this message]
2016-01-29  9:44 ` [PATCH v4 14/25] mmc: sdhci: factor out sdhci_pre_dma_transfer() from sdhci_adma_table_pre() Russell King
2016-01-29  9:45 ` [PATCH v4 15/25] mmc: sdhci: pass the cookie into sdhci_pre_dma_transfer() Russell King
2016-01-29  9:45 ` [PATCH v4 16/25] mmc: sdhci: always unmap a mapped data transfer in sdhci_post_req() Russell King
2016-01-29  9:45 ` [PATCH v4 17/25] mmc: sdhci: clean up host cookie handling Russell King
2016-01-29  9:45 ` [PATCH v4 18/25] mmc: sdhci: plug DMA mapping leak on error Russell King
2016-01-29  9:45 ` [PATCH v4 19/25] mmc: sdhci-pxav3: fix higher speed mode capabilities Russell King
2016-01-29  9:45 ` [PATCH v4 20/25] mmc: sdhci: further fix for DMA unmapping in sdhci_post_req() Russell King
2016-01-29  9:45 ` [PATCH v4 21/25] mmc: sdhci: fix data timeout (part 1) Russell King
2016-01-29  9:45 ` [PATCH v4 22/25] mmc: sdhci: fix data timeout (part 2) Russell King
2016-01-29  9:45 ` [PATCH v4 23/25] mmc: sdhci: prepare DMA address/size quirk handling consolidation Russell King
2016-01-29  9:45 ` [PATCH v4 24/25] mmc: sdhci: consolidate the DMA/ADMA size/address quicks Russell King
2016-01-29  9:45 ` [PATCH v4 25/25] mmc: sdhci: further code simplication Russell King
2016-02-04 10:55 ` [PATCH v4 00/25] MMC/SDHCI fixes Ulf Hansson
2016-02-12  9:49   ` Adrian Hunter
2016-02-12 14:23     ` Gregory CLEMENT
2016-02-16 13:08     ` 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=E1aP5bo-0001pn-N0@rmk-PC.arm.linux.org.uk \
    --to=rmk+kernel@arm.linux.org.uk \
    --cc=gregory.clement@free-electrons.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mw@semihalf.com \
    --cc=shawnguo@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