diff options
author | Haijun Zhang <Haijun.Zhang@freescale.com> | 2014-05-05 08:26:47 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-06 03:10:16 (GMT) |
commit | d4110504d8cce07c5b373ff73bc1181507937405 (patch) | |
tree | 0d61a526fbf8114545652f5aabb324fe1322acff /drivers/mmc/core | |
parent | b721365fe4175bee2a792b1268fb68929d2fbc84 (diff) | |
download | linux-fsl-qoriq-d4110504d8cce07c5b373ff73bc1181507937405.tar.xz |
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 <Haijun.Zhang@freescale.com>
Change-Id: I1c2d26171a7ca02c2ecd2f029e37c5b715fb4105
Reviewed-on: http://git.am.freescale.net:8181/11804
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Xiaobo Xie <X.Xie@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r-- | drivers/mmc/core/bus.c | 18 |
1 files changed, 11 insertions, 7 deletions
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); |