]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: core: Extend shutdown sequence to handle bus operations
authorUlf Hansson <ulf.hansson@linaro.org>
Mon, 10 Jun 2013 15:03:41 +0000 (17:03 +0200)
committerChris Ball <cjb@laptop.org>
Thu, 27 Jun 2013 16:39:18 +0000 (12:39 -0400)
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>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/bus.c
drivers/mmc/core/core.h

index 219bf4b1d97e9a06b18592f3f2ff55596efc7525..4c0decfffb5369062e539ea8f8d25d81fd811755 100644 (file)
@@ -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
index 79f37cfc373b80d14b0e9a68ca11ede7f0953fdb..5345d156493efcc00dcb11790aa145d0f4ea51a0 100644 (file)
@@ -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);