aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/sdio.c
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-05-29 09:36:03 -0400
committerLuciano Coelho <coelho@ti.com>2011-06-27 05:01:31 -0400
commit86046da4afe068991b77e0a4c4b79b99ad961bda (patch)
tree1b7d3030dd4f289786d5e29d15fa4de8aa092b35 /drivers/net/wireless/wl12xx/sdio.c
parentd2c2bb9fccdfe3cb70b276ae69e53d4890b11871 (diff)
wl12xx: don't bail if mmc isn't MMC_CAP_POWER_OFF_CARD
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>
Diffstat (limited to 'drivers/net/wireless/wl12xx/sdio.c')
-rw-r--r--drivers/net/wireless/wl12xx/sdio.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 6b60caf7e3ed..25215199049f 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)
161 struct sdio_func *func = wl_to_func(wl); 161 struct sdio_func *func = wl_to_func(wl);
162 int ret; 162 int ret;
163 163
164 /* Make sure the card will not be powered off by runtime PM */ 164 /* If enabled, tell runtime PM not to power off the card */
165 ret = pm_runtime_get_sync(&func->dev); 165 if (pm_runtime_enabled(&func->dev)) {
166 if (ret < 0) 166 ret = pm_runtime_get_sync(&func->dev);
167 goto out; 167 if (ret)
168 goto out;
169 }
168 170
169 /* Runtime PM might be disabled, so power up the card manually */ 171 /* Runtime PM might be disabled, so power up the card manually */
170 ret = mmc_power_restore_host(func->card->host); 172 ret = mmc_power_restore_host(func->card->host);
@@ -191,8 +193,11 @@ static int wl1271_sdio_power_off(struct wl1271 *wl)
191 if (ret < 0) 193 if (ret < 0)
192 return ret; 194 return ret;
193 195
194 /* Let runtime PM know the card is powered off */ 196 /* If enabled, let runtime PM know the card is powered off */
195 return pm_runtime_put_sync(&func->dev); 197 if (pm_runtime_enabled(&func->dev))
198 ret = pm_runtime_put_sync(&func->dev);
199
200 return ret;
196} 201}
197 202
198static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable) 203static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)