[PATCH v2] mmc: core: issue power off notification when host is removed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



User is possible to turn the power off after a host was removed.
So, call _mmc_suspend() to issue the power off notification when
a host is removing. Note that, to prevent _mmc_resume() calling
in mmc_runtime_resume(), call mmc_card_clr_suspended() in
mmc_remove() before mmc_remove_card(). Otherwise, _mmc_resume()
call mmc_init_card() while removing the host.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
---
 Changes from v1:
 - Reuse _mmc_suspend() instead of direct mmc_poweroff_notify() calling
  to check suspended flag while removing.
  https://patchwork.kernel.org/project/linux-renesas-soc/patch/1602581312-23607-1-git-send-email-yoshihiro.shimoda.uh@xxxxxxxxxxx/

 drivers/mmc/core/mmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index ff3063c..0f83466 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1983,11 +1983,16 @@ static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
 	return err;
 }
 
+static int _mmc_suspend(struct mmc_host *host, bool is_suspend);
 /*
  * Host is being removed. Free up the current card.
  */
 static void mmc_remove(struct mmc_host *host)
 {
+	_mmc_suspend(host, false);
+	/* Prevent _mmc_resume() calling in mmc_runtime_resume() */
+	mmc_card_clr_suspended(host->card);
+
 	mmc_remove_card(host->card);
 	host->card = NULL;
 }
-- 
2.7.4




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux