提交 e79e72c5 编写于 作者: J Jarkko Nikula 提交者: Wolfram Sang

i2c: designware: Keep pm_runtime_enable/_disable calls in sync

On an hardware shared I2C bus (certain Intel Baytrail SoC platforms) the
runtime PM disable depth keeps increasing over repeated modprobe/rmmod
cycle because pm_runtime_disable() is called without checking should it
be disabled already because of bus sharing.

This hasn't made any other harm than dev->power.disable_depth keeps
increasing but keep it sync by calling pm_runtime_disable() only when
runtime PM is not disabled.
Reported-by: NWolfram Sang <wsa@the-dreams.de>
Signed-off-by: NJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
上级 2d244c81
...@@ -245,12 +245,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -245,12 +245,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
} }
r = i2c_dw_probe(dev); r = i2c_dw_probe(dev);
if (r) { if (r && !dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return r;
}
return 0; return r;
} }
static int dw_i2c_plat_remove(struct platform_device *pdev) static int dw_i2c_plat_remove(struct platform_device *pdev)
...@@ -265,6 +263,7 @@ static int dw_i2c_plat_remove(struct platform_device *pdev) ...@@ -265,6 +263,7 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
pm_runtime_dont_use_autosuspend(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
if (!dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册