[PATCH] mmc: bus: check suspend/resume hooks for bus_ops before calling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It needs to check suspend/resume hooks before calling them to avoid
call trace during hibernation.

Signed-off-by: Yangbo Lu <yangbo.lu@xxxxxxxxxxxxx>
---
 drivers/mmc/core/bus.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 972ff84..fc6b5e5 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -154,7 +154,8 @@ static int mmc_bus_suspend(struct device *dev)
 	if (ret)
 		return ret;
 
-	ret = host->bus_ops->suspend(host);
+	if (host->bus_ops->suspend)
+		ret = host->bus_ops->suspend(host);
 	return ret;
 }
 
@@ -164,10 +165,12 @@ static int mmc_bus_resume(struct device *dev)
 	struct mmc_host *host = card->host;
 	int ret;
 
-	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);
+	}
 
 	ret = pm_generic_resume(dev);
 	return ret;
-- 
2.1.0.27.g96db324

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux