summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDavid Yu <davyu@nvidia.com>2014-01-24 15:28:59 +0900
committerHarry Hong <hhong@nvidia.com>2014-01-26 22:16:03 -0800
commit2e9f249d65d3fca96a18137cb193643ba5197577 (patch)
tree67a8c7d4cc36cecd44f5e169b6b623604c8e7af0 /drivers
parent737c254bc98bb1ea2de79784da67511625dbc36b (diff)
mmc: core: Handle card shutdown from mmc_bus
Considering shutdown of the card, the responsibility to initate this sequence shall be driven from the mmc_bus. This patch enables the mmc_bus to handle this sequence properly. A new .shutdown callback is added in the mmc_driver struct which is used to shutdown the blk device. Bug 1445876 Change-Id: I947315a7102606a1873eeebf136d741c98b46c76 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: David Yu <davyu@nvidia.com> Reviewed-on: http://git-master/r/359692 Reviewed-by: Harry Hong <hhong@nvidia.com> Tested-by: Harry Hong <hhong@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/card/block.c15
-rw-r--r--drivers/mmc/core/bus.c10
2 files changed, 23 insertions, 2 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 99de5dcc62c3..1948a6498c4d 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2298,8 +2298,7 @@ static void mmc_blk_remove(struct mmc_card *card)
#endif
}
-#ifdef CONFIG_PM
-static int mmc_blk_suspend(struct mmc_card *card)
+static int _mmc_blk_suspend(struct mmc_card *card)
{
struct mmc_blk_data *part_md;
struct mmc_blk_data *md = mmc_get_drvdata(card);
@@ -2313,6 +2312,17 @@ static int mmc_blk_suspend(struct mmc_card *card)
return 0;
}
+static void mmc_blk_shutdown(struct mmc_card *card)
+{
+ _mmc_blk_suspend(card);
+}
+
+#ifdef CONFIG_PM
+static int mmc_blk_suspend(struct mmc_card *card)
+{
+ return _mmc_blk_suspend(card);
+}
+
static int mmc_blk_resume(struct mmc_card *card)
{
struct mmc_blk_data *part_md;
@@ -2344,6 +2354,7 @@ static struct mmc_driver mmc_driver = {
.remove = mmc_blk_remove,
.suspend = mmc_blk_suspend,
.resume = mmc_blk_resume,
+ .shutdown = mmc_blk_shutdown,
};
static int __init mmc_blk_init(void)
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 4ab887afe1ed..0d7235fb0f89 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -133,6 +133,15 @@ static int mmc_bus_remove(struct device *dev)
return 0;
}
+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);
+
+ if (dev->driver && drv->shutdown)
+ drv->shutdown(card);
+}
+
static int mmc_bus_suspend(struct device *dev, pm_message_t state)
{
struct mmc_driver *drv = to_mmc_driver(dev->driver);
@@ -198,6 +207,7 @@ static struct bus_type mmc_bus_type = {
.probe = mmc_bus_probe,
.remove = mmc_bus_remove,
.suspend = mmc_bus_suspend,
+ .shutdown = mmc_bus_shutdown,
.resume = mmc_bus_resume,
.pm = MMC_PM_OPS_PTR,
};