From d4110504d8cce07c5b373ff73bc1181507937405 Mon Sep 17 00:00:00 2001 From: Haijun Zhang Date: Mon, 5 May 2014 16:26:47 +0800 Subject: mmc:eSDHC: Fix mmc call trace during hibernation For removable card we avoid to invoke resume and suspend call back function, because it's not safe in case card was removed and replaced with a new one during suspend. But it's still need to judge the bus_ops hook before we run it. Signed-off-by: Haijun Zhang Change-Id: I1c2d26171a7ca02c2ecd2f029e37c5b715fb4105 Reviewed-on: http://git.am.freescale.net:8181/11804 Tested-by: Review Code-CDREVIEW Reviewed-by: Xiaobo Xie Reviewed-by: Jose Rivera diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 704bf66..c7efd21 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -146,7 +146,7 @@ static int mmc_bus_suspend(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; + int ret = -ENODEV; if (dev->driver && drv->suspend) { ret = drv->suspend(card); @@ -154,7 +154,9 @@ static int mmc_bus_suspend(struct device *dev) return ret; } - ret = host->bus_ops->suspend(host); + if (host->bus_ops->suspend) + ret = host->bus_ops->suspend(host); + return ret; } @@ -163,12 +165,14 @@ static int mmc_bus_resume(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; + int ret = -ENODEV; - ret = host->bus_ops->resume(host); - if (ret) - pr_warn("%s: error %d during resume (card was removed?)\n", - mmc_hostname(host), ret); + if (host->bus_ops->resume) { + ret = host->bus_ops->resume(host); + if (ret) + pr_warn("%s: error %d during resume (card was removed?)\n", + mmc_hostname(host), ret); + } if (dev->driver && drv->resume) ret = drv->resume(card); -- cgit v0.10.2