mmc: core: Reset on error during deferred resume

If resume fails, there is no way to handle it now.
Also there's no attempt to recover from it.
This leads to lot of warnings while issuing requests.

Check for resume errors & reset the stack on error as
an attempt to recover from it.

Change-Id: Ie4d6d2a34c2c7a8154696e93d85e50d60410e0c2
Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
This commit is contained in:
Asutosh Das 2018-01-02 15:38:27 +05:30
parent eb1480ce5a
commit 8e75e263e6

View file

@ -3239,20 +3239,31 @@ int mmc_resume_bus(struct mmc_host *host)
if (host->bus_ops && !host->bus_dead && host->card) { if (host->bus_ops && !host->bus_dead && host->card) {
mmc_power_up(host, host->card->ocr); mmc_power_up(host, host->card->ocr);
BUG_ON(!host->bus_ops->resume); BUG_ON(!host->bus_ops->resume);
host->bus_ops->resume(host); err = host->bus_ops->resume(host);
if (err) {
pr_err("%s: bus resume: failed: %d\n",
mmc_hostname(host), err);
err = mmc_hw_reset(host);
if (err) {
pr_err("%s: reset: failed: %d\n",
mmc_hostname(host), err);
goto err_reset;
} else {
mmc_card_clr_suspended(host->card);
}
}
if (mmc_card_cmdq(host->card)) { if (mmc_card_cmdq(host->card)) {
err = mmc_cmdq_halt(host, false); err = mmc_cmdq_halt(host, false);
if (err) if (err)
pr_err("%s: %s: unhalt failed: %d\n", pr_err("%s: %s: unhalt failed: %d\n",
mmc_hostname(host), __func__, err); mmc_hostname(host), __func__, err);
else
mmc_card_clr_suspended(host->card);
} }
} }
err_reset:
mmc_bus_put(host); mmc_bus_put(host);
pr_debug("%s: Deferred resume completed\n", mmc_hostname(host)); pr_debug("%s: Deferred resume completed\n", mmc_hostname(host));
return 0; return err;
} }
EXPORT_SYMBOL(mmc_resume_bus); EXPORT_SYMBOL(mmc_resume_bus);