All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eliad Peller <eliad@wizery.com>
To: linux-mmc@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>, Ido Yariv <ido@wizery.com>
Subject: [PATCH] mmc: core: don't call bus_ops->power_restore if already on
Date: Tue,  5 May 2015 19:03:47 +0300	[thread overview]
Message-ID: <1430841827-7834-1-git-send-email-eliad@wizery.com> (raw)

mmc_power_restore_host() calls mmc_power_up(), which
returns immediately if power is already on.

However, it still calls host->bus_ops->power_restore,
which might result in various errors if the bus_ops
doesn't handle it well (e.g. failing to run init
sequence twice)

Simply bail out in this case, without further calling
bus_ops->power_restore.

Specifically, this solves issue with wl18xx sdio card,
where the mmc core powers on the card on resume (while
MMC_PM_KEEP_POWER is not set), and the wl18xx device
driver calls mmc_power_restore_host() once more.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Ido Yariv <ido@wizery.com>
---
 drivers/mmc/core/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index c296bc0..797b574 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2604,6 +2604,11 @@ int mmc_power_restore_host(struct mmc_host *host)
 		return -EINVAL;
 	}
 
+	if (host->ios.power_mode == MMC_POWER_ON) {
+		mmc_bus_put(host);
+		return 0;
+	}
+
 	mmc_power_up(host, host->card->ocr);
 	ret = host->bus_ops->power_restore(host);
 
-- 
1.8.5.2.229.g4448466.dirty


             reply	other threads:[~2015-05-05 16:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-05 16:03 Eliad Peller [this message]
2015-05-11  8:48 ` [PATCH] mmc: core: don't call bus_ops->power_restore if already on Ulf Hansson
2015-05-11 11:07   ` Eliad Peller
2015-05-11 11:47     ` Ulf Hansson
2015-05-11 12:02       ` Eliad Peller
2015-05-11 13:50         ` Ulf Hansson
2015-05-11 14:04           ` Eliad Peller

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=1430841827-7834-1-git-send-email-eliad@wizery.com \
    --to=eliad@wizery.com \
    --cc=ido@wizery.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.