Commit b6ad726e authored by Ulf Hansson's avatar Ulf Hansson Committed by Chris Ball

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: default avatarUlf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: default avatarSujit Reddy Thumma <sthumma@codeaurora.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent b4625dab
...@@ -2294,6 +2294,14 @@ int mmc_suspend_host(struct mmc_host *host) ...@@ -2294,6 +2294,14 @@ int mmc_suspend_host(struct mmc_host *host)
mmc_bus_get(host); mmc_bus_get(host);
if (host->bus_ops && !host->bus_dead) { if (host->bus_ops && !host->bus_dead) {
/*
* A long response time is not acceptable for device drivers
* when doing suspend. Prevent mmc_claim_host in the suspend
* sequence, to potentially wait "forever" by trying to
* pre-claim the host.
*/
if (mmc_try_claim_host(host)) {
if (host->bus_ops->suspend) if (host->bus_ops->suspend)
err = host->bus_ops->suspend(host); err = host->bus_ops->suspend(host);
if (err == -ENOSYS || !host->bus_ops->resume) { if (err == -ENOSYS || !host->bus_ops->resume) {
...@@ -2310,6 +2318,10 @@ int mmc_suspend_host(struct mmc_host *host) ...@@ -2310,6 +2318,10 @@ int mmc_suspend_host(struct mmc_host *host)
host->pm_flags = 0; host->pm_flags = 0;
err = 0; err = 0;
} }
mmc_do_release_host(host);
} else {
err = -EBUSY;
}
} }
mmc_bus_put(host); mmc_bus_put(host);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment