From: Pierre Ossman Date: Sat, 28 Apr 2007 15:30:50 +0000 (+0200) Subject: mmc: remove card upon suspend X-Git-Tag: firefly_0821_release~30182^2~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b5af25bee2de2f6cd1ac74ba737cbc4f3d303e5d;p=firefly-linux-kernel-4.4.55.git mmc: remove card upon suspend Suspending MMC/SD cards (versus removing and readding them) is an inherently unsafe operation and has even been broken for some time. Signed-off-by: Pierre Ossman --- diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 0242c6a21daf..94c04725726d 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1738,10 +1738,17 @@ EXPORT_SYMBOL(mmc_free_host); */ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) { - mmc_claim_host(host); - mmc_deselect_cards(host); + struct list_head *l, *n; + + mmc_flush_scheduled_work(); + + list_for_each_safe(l, n, &host->cards) { + struct mmc_card *card = mmc_list_to_card(l); + + mmc_remove_card(card); + } + mmc_power_off(host); - mmc_release_host(host); return 0; }