diff mbox

I2C: Fix for suspend/resume issue in i2c-core

Message ID 1283219414-8798-1-git-send-email-vishwanath.bs@ti.com (mailing list archive)
State Awaiting Upstream, archived
Headers show

Commit Message

Sripathy, Vishwanath Aug. 31, 2010, 1:50 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176..3146bff
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -196,14 +196,22 @@  static int i2c_legacy_resume(struct device *dev)
 static int i2c_device_pm_suspend(struct device *dev)
 {
 	const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
+	int ret;
 
 	if (pm_runtime_suspended(dev))
 		return 0;
 
 	if (pm)
-		return pm->suspend ? pm->suspend(dev) : 0;
+		ret = pm->suspend ? pm->suspend(dev) : 0;
+	else
+		ret = i2c_legacy_suspend(dev, PMSG_SUSPEND);
 
-	return i2c_legacy_suspend(dev, PMSG_SUSPEND);
+	if (!ret) {
+		pm_runtime_disable(dev);
+		pm_runtime_set_suspended(dev);
+		pm_runtime_enable(dev);
+	}
+	return ret;
 }
 
 static int i2c_device_pm_resume(struct device *dev)