Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dab5e601 authored by Asutosh Das's avatar Asutosh Das Committed by Ram Prakash Gupta
Browse files

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: default avatarAsutosh Das <asutoshd@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent f0903616
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -2680,19 +2680,16 @@ int mmc_resume_bus(struct mmc_host *host)
		mmc_power_up(host, host->card->ocr);
		BUG_ON(!host->bus_ops->deferred_resume);
		err = host->bus_ops->deferred_resume(host);
		if (err && (err != -ENOMEDIUM)) {
			pr_err("%s: bus resume: failed: %d\n",
			       mmc_hostname(host), err);
			err = mmc_hw_reset(host);
			if (err) {
			pr_err("%s: %s: resume failed: %d\n",
				       mmc_hostname(host), __func__, err);
			/*
			 * If we have cd-gpio based detection mechanism and
			 * deferred resume is supported, we will not detect
			 * card removal event when system is suspended. So if
			 * resume fails after a system suspend/resume,
			 * schedule the work to detect card presence.
			 */
			if (mmc_card_is_removable(host) &&
					!(host->caps & MMC_CAP_NEEDS_POLL)) {
				mmc_detect_change(host, 0);
				pr_err("%s: reset: failed: %d\n",
				       mmc_hostname(host), err);
				goto err_reset;
			} else {
				mmc_card_clr_suspended(host->card);
			}
		}
		if (host->card->ext_csd.cmdq_en && !host->cqe_enabled) {
@@ -2701,14 +2698,13 @@ int mmc_resume_bus(struct mmc_host *host)
			if (err)
				pr_err("%s: %s: cqe enable failed: %d\n",
				       mmc_hostname(host), __func__, err);
			else
				mmc_card_clr_suspended(host->card);
		}
	}

err_reset:
	mmc_bus_put(host);
	pr_debug("%s: Deferred resume completed\n", mmc_hostname(host));
	return 0;
	return err;
}
EXPORT_SYMBOL(mmc_resume_bus);