Skip to content

Commit

Permalink
wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARD
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Ohad Ben-Cohen authored and Luciano Coelho committed Jun 27, 2011
1 parent d2c2bb9 commit 86046da
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions drivers/net/wireless/wl12xx/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 86046da

Please sign in to comment.