summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDavid Schalig <dschalig@nvidia.com>2011-06-01 18:32:13 +0900
committerYuhao Ding <yding@nvidia.com>2011-06-16 18:26:20 -0700
commite69f9291f85c4eeaa02091111a8fc8835efe333e (patch)
tree7d45a18fba2b3f22063ea9c7d757a56ee1090819 /drivers
parentc3adbb7631627dc14c864a4d9ab8fd2e8e319c2d (diff)
mmc: fix card detect after suspend
If defered SD card resume (CONFIG_MMC_BLOCK_DEFERRED_RESUME) is enabled, PM_POST_SUSPEND handler will never set host->rescan_disable back to 0, and card detect logic will be disabled forever. fix missing break fix incorrect cleanup sequences Bug 833034 http://git-master/r/#change,36251 (cherry picked from commit 31d509d8e2e2b7c35da69029f932d35c3995fe36) Change-Id: I3e513359af68e92476d693f4d1751b4b0d883569 Reviewed-on: http://git-master/r/36429 Reviewed-by: David Schalig <dschalig@nvidia.com> Tested-by: David Schalig <dschalig@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/bus.c1
-rw-r--r--drivers/mmc/core/core.c8
-rw-r--r--drivers/mmc/core/debugfs.c2
-rw-r--r--drivers/mmc/core/sd.c15
4 files changed, 14 insertions, 12 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 7cd9749dc21d..b2a89da738ea 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -248,6 +248,7 @@ int mmc_add_card(struct mmc_card *card)
type = "SD-combo";
if (mmc_card_blockaddr(card))
type = "SDHC-combo";
+ break;
default:
type = "?";
break;
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index ad32bd77321f..4b72c2b7ab87 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -996,10 +996,10 @@ int mmc_resume_bus(struct mmc_host *host)
mmc_power_up(host);
BUG_ON(!host->bus_ops->resume);
host->bus_ops->resume(host);
- }
- if (host->bus_ops->detect && !host->bus_dead)
- host->bus_ops->detect(host);
+ if (host->bus_ops->detect)
+ host->bus_ops->detect(host);
+ }
mmc_bus_put(host);
printk("%s: Deferred resume completed\n", mmc_hostname(host));
@@ -1782,11 +1782,11 @@ int mmc_pm_notify(struct notifier_block *notify_block,
case PM_POST_RESTORE:
spin_lock_irqsave(&host->lock, flags);
+ host->rescan_disable = 0;
if (mmc_bus_manual_resume(host)) {
spin_unlock_irqrestore(&host->lock, flags);
break;
}
- host->rescan_disable = 0;
spin_unlock_irqrestore(&host->lock, flags);
mmc_detect_change(host, 0);
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 53cb380c0987..9e0c43e74461 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -164,6 +164,7 @@ err_root:
void mmc_remove_host_debugfs(struct mmc_host *host)
{
debugfs_remove_recursive(host->debugfs_root);
+ host->debugfs_root = NULL;
}
static int mmc_dbg_card_status_get(void *data, u64 *val)
@@ -290,4 +291,5 @@ err:
void mmc_remove_card_debugfs(struct mmc_card *card)
{
debugfs_remove_recursive(card->debugfs_root);
+ card->debugfs_root = NULL;
}
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 7ab8fdc61c77..b2f0f5d37fa9 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -605,7 +605,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (!mmc_host_is_spi(host)) {
err = mmc_send_relative_addr(host, &card->rca);
if (err)
- return err;
+ goto free_card;
mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
}
@@ -613,7 +613,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (!oldcard) {
err = mmc_sd_get_csd(host, card);
if (err)
- return err;
+ goto free_card;
mmc_decode_cid(card);
}
@@ -624,7 +624,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (!mmc_host_is_spi(host)) {
err = mmc_select_card(card);
if (err)
- return err;
+ goto free_card;
}
err = mmc_sd_setup_card(host, card, oldcard != NULL);
@@ -672,11 +672,10 @@ free_card:
*/
static void mmc_sd_remove(struct mmc_host *host)
{
- BUG_ON(!host);
- BUG_ON(!host->card);
-
- mmc_remove_card(host->card);
- host->card = NULL;
+ if (host && host->card) {
+ mmc_remove_card(host->card);
+ host->card = NULL;
+ }
}
/*