Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378808 > unrolled thread

[PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization

Started byJisheng Zhang <jszhang@marvell.com>
First post2016-04-14 15:00 +0200
Last post2016-04-14 15:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization Jisheng Zhang <jszhang@marvell.com> - 2016-04-14 15:00 +0200

#1378808 — [PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization

FromJisheng Zhang <jszhang@marvell.com>
Date2016-04-14 15:00 +0200
Subject[PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization
Message-ID<rnP2i-1K8-9@gated-at.bofh.it>
When pm_runtime_enable() was being called, the device's usage counter
was 0, causing the PM layer to runtime-suspend the device.  We then
went on to call i2c_dw_probe() on a suspended device, which could hung.

Fix this by incrementing the usage counter before pm_runtime_enable().

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index d656657..00f9e99 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -246,6 +246,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	if (dev->pm_runtime_disabled) {
 		pm_runtime_forbid(&pdev->dev);
 	} else {
+		pm_runtime_get_noresume(&pdev->dev);
 		pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
 		pm_runtime_use_autosuspend(&pdev->dev);
 		pm_runtime_set_active(&pdev->dev);
@@ -253,8 +254,19 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 	}
 
 	r = i2c_dw_probe(dev);
-	if (r && !dev->pm_runtime_disabled)
+	if (r)
+		goto rpm_disable;
+
+	if (!dev->pm_runtime_disabled)
+		pm_runtime_put_autosuspend(&pdev->dev);
+
+	return 0;
+
+rpm_disable:
+	if (!dev->pm_runtime_disabled) {
 		pm_runtime_disable(&pdev->dev);
+		pm_runtime_put_noidle(&pdev->dev);
+	}
 
 	return r;
 }
-- 
2.8.0.rc3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web