usb: otg: Do not call runtime suspend from system suspend callback
According to the commit text of "PM: Limit race conditions between
runtime PM and system sleep (v2)", a driver should not call
pm_runtime_suspend() from its .suspend() callback, as that creates
a recursive call into the subsystem.
This fixes msm_otg_pm_suspend() from doing just that. Instead, call
the helper function to explicitly suspend, without depending on the
runtime PM call. Likewise, the system resume callback should actually
resume the device.
Change-Id: I6ef0609dc4979ad31ef338e1eee3d21af47c256b
Signed-off-by: Jack Pham <jackp@codeaurora.org>
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 7830e29..420f417 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -3549,35 +3549,28 @@
#ifdef CONFIG_PM_SLEEP
static int msm_otg_pm_suspend(struct device *dev)
{
- int ret;
+ struct msm_otg *motg = dev_get_drvdata(dev);
dev_dbg(dev, "OTG PM suspend\n");
-
-#ifdef CONFIG_PM_RUNTIME
- ret = pm_runtime_suspend(dev);
- if (ret > 0)
- ret = 0;
-#else
- ret = msm_otg_suspend(dev_get_drvdata(dev));
-#endif
- return ret;
+ return msm_otg_suspend(motg);
}
static int msm_otg_pm_resume(struct device *dev)
{
struct msm_otg *motg = dev_get_drvdata(dev);
+ int ret;
dev_dbg(dev, "OTG PM resume\n");
+ ret = msm_otg_resume(motg);
+ if (ret)
+ return ret;
-#ifdef CONFIG_PM_RUNTIME
- /*
- * Do not resume hardware as part of system resume,
- * rather, wait for the ASYNC INT from the h/w
- */
+ /* Update runtime PM status */
+ pm_runtime_disable(dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(dev);
+
return 0;
-#endif
-
- return msm_otg_resume(motg);
}
#endif