linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ohad Ben-Cohen <ohad@wizery.com>
To: Daniel Drake <dsd@laptop.org>
Cc: linux-mmc@vger.kernel.org
Subject: Re: -ENOSYS suspend-powerdown regression
Date: Sun, 5 Jun 2011 02:08:18 +0300	[thread overview]
Message-ID: <BANLkTikvP3hc+CHEwrUEDqN6McwswikS-Q@mail.gmail.com> (raw)
In-Reply-To: <BANLkTimRWqo1M7OOQmdWOxSQvqiNx48Ftg@mail.gmail.com>

... going back to the call trace you provided ...

On Sat, Jun 4, 2011 at 1:18 PM, Daniel Drake <dsd@laptop.org> wrote:
> Here is the call trace:
>
> mmc_suspend_host
> mmc_sdio_remove
> sdio_remove_func
> device_del

This eventually disables runtime PM for your SDIO function.

We can stop checking the return value of pm_runtime_get_sync in
sdio_bus_remove, like pci_device_remove is doing, but I don't think
that's enough: I guess libertas' if_sdio_remove won't be so happy
dealing with a powered off card.

Can you try the following please (untested):

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 4d0c15b..8af3330 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -540,6 +540,13 @@ static void mmc_sdio_remove(struct mmc_host *host)
 	BUG_ON(!host);
 	BUG_ON(!host->card);

+	/*
+	 * if this card is managed by runtime pm, make sure it is powered on
+	 * before invoking its SDIO functions' ->remove() handler
+	 */
+	if (host->caps & MMC_CAP_POWER_OFF_CARD)
+		pm_runtime_get_sync(&host->card->dev);
+
 	for (i = 0;i < host->card->sdio_funcs;i++) {
 		if (host->card->sdio_func[i]) {
 			sdio_remove_func(host->card->sdio_func[i]);
@@ -547,6 +554,9 @@ static void mmc_sdio_remove(struct mmc_host *host)
 		}
 	}

+	if (host->caps & MMC_CAP_POWER_OFF_CARD)
+		pm_runtime_put_noidle(&host->card->dev);
+
 	mmc_remove_card(host->card);
 	host->card = NULL;
 }
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index d29b9c3..73dc3c2 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -167,11 +167,8 @@ static int sdio_bus_remove(struct device *dev)
 	int ret = 0;

 	/* Make sure card is powered before invoking ->remove() */
-	if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD) {
-		ret = pm_runtime_get_sync(dev);
-		if (ret < 0)
-			goto out;
-	}
+	if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
+		pm_runtime_get_sync(dev);

 	drv->remove(func);

@@ -191,7 +188,6 @@ static int sdio_bus_remove(struct device *dev)
 	if (func->card->host->caps & MMC_CAP_POWER_OFF_CARD)
 		pm_runtime_put_noidle(dev);

-out:
 	return ret;
 }

  parent reply	other threads:[~2011-06-04 23:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30 14:26 -ENOSYS suspend-powerdown regression Daniel Drake
2011-06-04  9:50 ` Daniel Drake
2011-06-04 10:18 ` Daniel Drake
2011-06-04 10:33   ` Ohad Ben-Cohen
2011-06-04 11:10     ` Daniel Drake
2011-06-04 23:08   ` Ohad Ben-Cohen [this message]
2011-06-05 12:31     ` Daniel Drake
2011-06-05 13:49       ` Ohad Ben-Cohen
2011-06-28  5:55       ` Ohad Ben-Cohen
2011-06-28 20:59         ` Daniel Drake
2011-06-28 21:47           ` Ohad Ben-Cohen
2011-06-28 21:54             ` Daniel Drake
2011-06-28 22:04               ` Ohad Ben-Cohen
2011-07-06 15:53                 ` Daniel Drake
2011-07-08 15:38                   ` Daniel Drake
2011-07-18  1:53                     ` Ohad Ben-Cohen

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=BANLkTikvP3hc+CHEwrUEDqN6McwswikS-Q@mail.gmail.com \
    --to=ohad@wizery.com \
    --cc=dsd@laptop.org \
    --cc=linux-mmc@vger.kernel.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).