aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@stericsson.com>2011-10-13 10:03:58 -0400
committerChris Ball <cjb@laptop.org>2011-10-26 16:32:31 -0400
commitb6ad726e3fe69e1ff3c3b2ad272ba3e4c376cd6a (patch)
treedc2413bb2454ca3aec4c2a5c894c7b926690abcb /drivers/mmc
parentb4625dab2c618eb87e177761dda3182b4cfaa604 (diff)
mmc: core: Prevent too long response times for suspend
While trying to suspend the mmc host there could still be ongoing requests that we need to wait for. At the same time a device driver must respond to a suspend request rather quickly. Instead of potentially wait "forever" by claiming the host we now "try" to claim the host instead. If it fails, -EBUSY is returned. Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-by: Sujit Reddy Thumma <sthumma@codeaurora.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/core.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index fe65bb377e2..5278ffb20e7 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2294,21 +2294,33 @@ int mmc_suspend_host(struct mmc_host *host)
2294 2294
2295 mmc_bus_get(host); 2295 mmc_bus_get(host);
2296 if (host->bus_ops && !host->bus_dead) { 2296 if (host->bus_ops && !host->bus_dead) {
2297 if (host->bus_ops->suspend) 2297
2298 err = host->bus_ops->suspend(host); 2298 /*
2299 if (err == -ENOSYS || !host->bus_ops->resume) { 2299 * A long response time is not acceptable for device drivers
2300 /* 2300 * when doing suspend. Prevent mmc_claim_host in the suspend
2301 * We simply "remove" the card in this case. 2301 * sequence, to potentially wait "forever" by trying to
2302 * It will be redetected on resume. 2302 * pre-claim the host.
2303 */ 2303 */
2304 if (host->bus_ops->remove) 2304 if (mmc_try_claim_host(host)) {
2305 host->bus_ops->remove(host); 2305 if (host->bus_ops->suspend)
2306 mmc_claim_host(host); 2306 err = host->bus_ops->suspend(host);
2307 mmc_detach_bus(host); 2307 if (err == -ENOSYS || !host->bus_ops->resume) {
2308 mmc_power_off(host); 2308 /*
2309 mmc_release_host(host); 2309 * We simply "remove" the card in this case.
2310 host->pm_flags = 0; 2310 * It will be redetected on resume.
2311 err = 0; 2311 */
2312 if (host->bus_ops->remove)
2313 host->bus_ops->remove(host);
2314 mmc_claim_host(host);
2315 mmc_detach_bus(host);
2316 mmc_power_off(host);
2317 mmc_release_host(host);
2318 host->pm_flags = 0;
2319 err = 0;
2320 }
2321 mmc_do_release_host(host);
2322 } else {
2323 err = -EBUSY;
2312 } 2324 }
2313 } 2325 }
2314 mmc_bus_put(host); 2326 mmc_bus_put(host);