diff options
author | Aaron Lu <aaron.lu@amd.com> | 2012-01-04 10:07:43 +0800 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2012-01-12 15:17:08 -0500 |
commit | 38a60ea2e7b33ab33ee11d6ef527f259edb102cf (patch) | |
tree | ebbac61ed86c4401ee602da0b632cb5556edd67c /drivers/mmc | |
parent | 3f514291df96e0a34bc61c7c456ca1d3fdc1f1bb (diff) | |
download | linux-stable-38a60ea2e7b33ab33ee11d6ef527f259edb102cf.tar.gz linux-stable-38a60ea2e7b33ab33ee11d6ef527f259edb102cf.tar.bz2 linux-stable-38a60ea2e7b33ab33ee11d6ef527f259edb102cf.zip |
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')
-rw-r--r-- | drivers/mmc/host/sdhci.c | 17 |
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: int sdhci_suspend_host(struct sdhci_host *host) { int ret; + bool has_tuning_timer; sdhci_disable_card_detection(host); /* Disable tuning since we are suspending */ - if (host->version >= SDHCI_SPEC_300 && host->tuning_count && - host->tuning_mode == SDHCI_TUNING_MODE_1) { + has_tuning_timer = host->version >= SDHCI_SPEC_300 && + host->tuning_count && host->tuning_mode == SDHCI_TUNING_MODE_1; + if (has_tuning_timer) { del_timer_sync(&host->tuning_timer); host->flags &= ~SDHCI_NEEDS_RETUNING; } ret = mmc_suspend_host(host->mmc); - if (ret) + if (ret) { + if (has_tuning_timer) { + host->flags |= SDHCI_NEEDS_RETUNING; + mod_timer(&host->tuning_timer, jiffies + + host->tuning_count * HZ); + } + + sdhci_enable_card_detection(host); + return ret; + } free_irq(host->irq, host); |