aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
authorAaron Lu <aaron.lu@amd.com>2012-01-03 21:07:43 -0500
committerChris Ball <cjb@laptop.org>2012-01-12 15:17:08 -0500
commit38a60ea2e7b33ab33ee11d6ef527f259edb102cf (patch)
treeebbac61ed86c4401ee602da0b632cb5556edd67c /drivers/mmc/host/sdhci.c
parent3f514291df96e0a34bc61c7c456ca1d3fdc1f1bb (diff)
mmc: sdhci: Deal with failure case in sdhci_suspend_host
If there are errors happened in sdhci_suspend_host, handle it so that when the function returns with an error, the host's behaviour is the same before this function call, e.g. card detection is enabled and tuning timer is active, etc. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Aaron Lu <aaron.lu@amd.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3d338b4b416a..0636e9a587b1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2349,19 +2349,30 @@ out:
2349int sdhci_suspend_host(struct sdhci_host *host) 2349int sdhci_suspend_host(struct sdhci_host *host)
2350{ 2350{
2351 int ret; 2351 int ret;
2352 bool has_tuning_timer;
2352 2353
2353 sdhci_disable_card_detection(host); 2354 sdhci_disable_card_detection(host);
2354 2355
2355 /* Disable tuning since we are suspending */ 2356 /* Disable tuning since we are suspending */
2356 if (host->version >= SDHCI_SPEC_300 && host->tuning_count && 2357 has_tuning_timer = host->version >= SDHCI_SPEC_300 &&
2357 host->tuning_mode == SDHCI_TUNING_MODE_1) { 2358 host->tuning_count && host->tuning_mode == SDHCI_TUNING_MODE_1;
2359 if (has_tuning_timer) {
2358 del_timer_sync(&host->tuning_timer); 2360 del_timer_sync(&host->tuning_timer);
2359 host->flags &= ~SDHCI_NEEDS_RETUNING; 2361 host->flags &= ~SDHCI_NEEDS_RETUNING;
2360 } 2362 }
2361 2363
2362 ret = mmc_suspend_host(host->mmc); 2364 ret = mmc_suspend_host(host->mmc);
2363 if (ret) 2365 if (ret) {
2366 if (has_tuning_timer) {
2367 host->flags |= SDHCI_NEEDS_RETUNING;
2368 mod_timer(&host->tuning_timer, jiffies +
2369 host->tuning_count * HZ);
2370 }
2371
2372 sdhci_enable_card_detection(host);
2373
2364 return ret; 2374 return ret;
2375 }
2365 2376
2366 free_irq(host->irq, host); 2377 free_irq(host->irq, host);
2367 2378