linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hkallweit1@gmail.com (Heiner Kallweit)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH v4 9/10] mmc: meson-gx: remove member mrq from struct meson_host
Date: Fri, 3 Mar 2017 20:59:16 +0100	[thread overview]
Message-ID: <a9cacbd0-22d6-2b0f-707c-cd78b1ed7f57@gmail.com> (raw)
In-Reply-To: <62912f3d-2307-cfff-3c69-c8b8ffaeb474@gmail.com>

Struct mmc_command includes a reference to the related mmc_request.
Therefore we don't have to store mrq separately in struct meson_host.
And we can remove some now unneeded WARN_ON's.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
---
v2:
- extended commit message
- added acked-by
v3:
- rebased
v4:
- no changes
---
 drivers/mmc/host/meson-gx-mmc.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index e904b0a5..5281014e 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -122,7 +122,6 @@
 struct meson_host {
 	struct	device		*dev;
 	struct	mmc_host	*mmc;
-	struct	mmc_request	*mrq;
 	struct	mmc_command	*cmd;
 
 	spinlock_t lock;
@@ -416,9 +415,6 @@ static void meson_mmc_request_done(struct mmc_host *mmc,
 {
 	struct meson_host *host = mmc_priv(mmc);
 
-	WARN_ON(host->mrq != mrq);
-
-	host->mrq = NULL;
 	host->cmd = NULL;
 	mmc_request_done(host->mmc, mrq);
 }
@@ -525,13 +521,9 @@ static void meson_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq)
 {
 	struct meson_host *host = mmc_priv(mmc);
 
-	WARN_ON(host->mrq != NULL);
-
 	/* Stop execution */
 	writel(0, host->regs + SD_EMMC_START);
 
-	host->mrq = mrq;
-
 	if (mrq->sbc)
 		meson_mmc_start_cmd(mmc, mrq->sbc);
 	else
@@ -555,7 +547,6 @@ static void meson_mmc_read_resp(struct mmc_host *mmc, struct mmc_command *cmd)
 static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 {
 	struct meson_host *host = dev_id;
-	struct mmc_request *mrq;
 	struct mmc_command *cmd;
 	u32 irq_en, status, raw_status;
 	irqreturn_t ret = IRQ_HANDLED;
@@ -565,11 +556,6 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 
 	cmd = host->cmd;
 
-	mrq = host->mrq;
-
-	if (WARN_ON(!mrq))
-		return IRQ_NONE;
-
 	if (WARN_ON(!cmd))
 		return IRQ_NONE;
 
@@ -616,7 +602,7 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 	else  {
 		dev_warn(host->dev, "Unknown IRQ! status=0x%04x: MMC CMD%u arg=0x%08x flags=0x%08x stop=%d\n",
 			 status, cmd->opcode, cmd->arg,
-			 cmd->flags, mrq->stop ? 1 : 0);
+			 cmd->flags, cmd->mrq->stop ? 1 : 0);
 		if (cmd->data) {
 			struct mmc_data *data = cmd->data;
 
@@ -643,14 +629,10 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
 {
 	struct meson_host *host = dev_id;
-	struct mmc_request *mrq = host->mrq;
 	struct mmc_command *cmd = host->cmd;
 	struct mmc_data *data;
 	unsigned int xfer_bytes;
 
-	if (WARN_ON(!mrq))
-		return IRQ_NONE;
-
 	if (WARN_ON(!cmd))
 		return IRQ_NONE;
 
@@ -664,8 +646,8 @@ static irqreturn_t meson_mmc_irq_thread(int irq, void *dev_id)
 	}
 
 	meson_mmc_read_resp(host->mmc, cmd);
-	if (!data || !data->stop || mrq->sbc)
-		meson_mmc_request_done(host->mmc, mrq);
+	if (!data || !data->stop || cmd->mrq->sbc)
+		meson_mmc_request_done(host->mmc, cmd->mrq);
 	else
 		meson_mmc_start_cmd(host->mmc, data->stop);
 
-- 
2.11.1

  parent reply	other threads:[~2017-03-03 19:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 19:49 [PATCH v4 0/10] mmc: meson-gx: series with smaller improvements Heiner Kallweit
2017-03-03 19:51 ` [PATCH v4 1/10] mmc: meson-gx: simplify bounce buffer setting in meson_mmc_start_cmd Heiner Kallweit
2017-03-03 19:52 ` [PATCH v4 2/10] mmc: meson-gx: make two functions return void Heiner Kallweit
2017-03-03 19:53 ` [PATCH v4 3/10] mmc: meson-gx: remove unused members irq, ocr_mask from struct meson_host Heiner Kallweit
2017-03-03 19:54 ` [PATCH v4 4/10] mmc: meson-gx: remove unneeded variable in meson_mmc_clk_init Heiner Kallweit
2017-03-03 19:55 ` [PATCH v4 5/10] mmc: meson-gx: remove member parent_mux from struct meson_host Heiner Kallweit
2017-03-03 19:56 ` [PATCH v4 6/10] mmc: meson-gx: fix error path in meson_mmc_clk_init / meson_mmc_probe Heiner Kallweit
2017-03-03 19:57 ` [PATCH v4 7/10] mmc: meson-gx: remove unneeded devm_kstrdup in meson_mmc_clk_init Heiner Kallweit
2017-03-03 19:58 ` [PATCH v4 8/10] mmc: meson-gx: improve initial configuration Heiner Kallweit
2017-03-03 19:59 ` Heiner Kallweit [this message]
2017-03-03 20:00 ` [PATCH v4 10/10] mmc: meson-gx: replace magic timeout numbers with constants Heiner Kallweit
2017-03-03 21:19 ` [PATCH v4 0/10] mmc: meson-gx: series with smaller improvements Kevin Hilman
2017-03-03 22:54   ` Heiner Kallweit
2017-03-04  5:33     ` Kevin Hilman
2017-03-04  5:36       ` Kevin Hilman

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=a9cacbd0-22d6-2b0f-707c-cd78b1ed7f57@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linus-amlogic@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).