diff mbox

[06/12] mmc: core: Extend shutdown sequence to handle bus operations

Message ID 1370876627-13439-7-git-send-email-ulf.hansson@stericsson.com
State Accepted
Commit 6b086bde71243e2596f9d8e3c060119b84110d33
Headers show

Commit Message

Ulf Hansson June 10, 2013, 3:03 p.m. UTC
From: Ulf Hansson <ulf.hansson@linaro.org>

By adding an optional .shutdown callback to the bus_ops struct we
provide the possibility to let each bus type handle it's shutdown
requirements.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/mmc/core/bus.c  |    9 +++++++++
 drivers/mmc/core/core.h |    1 +
 2 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 219bf4b..4c0decf 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -126,8 +126,17 @@  static void mmc_bus_shutdown(struct device *dev)
 {
 	struct mmc_driver *drv = to_mmc_driver(dev->driver);
 	struct mmc_card *card = mmc_dev_to_card(dev);
+	struct mmc_host *host = card->host;
+	int ret;
 
 	drv->shutdown(card);
+
+	if (host->bus_ops->shutdown) {
+		ret = host->bus_ops->shutdown(host);
+		if (ret)
+			pr_warn("%s: error %d during shutdown\n",
+				mmc_hostname(host), ret);
+	}
 }
 
 #ifdef CONFIG_PM_SLEEP
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 79f37cf..5345d15 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -26,6 +26,7 @@  struct mmc_bus_ops {
 	int (*power_save)(struct mmc_host *);
 	int (*power_restore)(struct mmc_host *);
 	int (*alive)(struct mmc_host *);
+	int (*shutdown)(struct mmc_host *);
 };
 
 void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);