diff mbox

wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARD

Message ID 1306676163-17325-1-git-send-email-ohad@wizery.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ohad Ben Cohen May 29, 2011, 1:36 p.m. UTC
If our SDIO function has its runtime PM disabled, don't try to
manipulate its runtime PM status at all. This way we can still
power on cards plugged to mmc hosts that are not MMC_CAP_POWER_OFF_CARD.

Reported-and-tested-by: Tim Yamin <tim@kangatronix.co.uk>
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
---
 drivers/net/wireless/wl12xx/sdio.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

Comments

Luciano Coelho June 27, 2011, 8:42 a.m. UTC | #1
On Sun, 2011-05-29 at 16:36 +0300, Ohad Ben-Cohen wrote:
> If our SDIO function has its runtime PM disabled, don't try to
> manipulate its runtime PM status at all. This way we can still
> power on cards plugged to mmc hosts that are not
> MMC_CAP_POWER_OFF_CARD.
> 
> Reported-and-tested-by: Tim Yamin <tim@kangatronix.co.uk>
> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
> --- 

Applied, thank you!
diff mbox

Patch

diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 74fd7c6..e3b0436 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -161,10 +161,12 @@  static int wl1271_sdio_power_on(struct wl1271 *wl)
 	struct sdio_func *func = wl_to_func(wl);
 	int ret;
 
-	/* Make sure the card will not be powered off by runtime PM */
-	ret = pm_runtime_get_sync(&func->dev);
-	if (ret < 0)
-		goto out;
+	/* If enabled, tell runtime PM not to power off the card */
+	if (pm_runtime_enabled(&func->dev)) {
+		ret = pm_runtime_get_sync(&func->dev);
+		if (ret)
+			goto out;
+	}
 
 	/* Runtime PM might be disabled, so power up the card manually */
 	ret = mmc_power_restore_host(func->card->host);
@@ -191,8 +193,11 @@  static int wl1271_sdio_power_off(struct wl1271 *wl)
 	if (ret < 0)
 		return ret;
 
-	/* Let runtime PM know the card is powered off */
-	return pm_runtime_put_sync(&func->dev);
+	/* If enabled, let runtime PM know the card is powered off */
+	if (pm_runtime_enabled(&func->dev))
+		ret = pm_runtime_put_sync(&func->dev);
+
+	return ret;
 }
 
 static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)