@@ -268,11 +268,16 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
i2c_dw_disable(dev);
+ if (!IS_ERR(dev->clk))
+ clk_disable_unprepare(dev->clk);
+
+ pm_runtime_disable(&pdev->dev);
+ pm_runtime_dont_use_autosuspend(&pdev->dev);
if (dev->pm_runtime_disabled)
pm_runtime_put_noidle(&pdev->dev);
- pm_runtime_dont_use_autosuspend(&pdev->dev);
- pm_runtime_put_sync(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
+
+ pm_runtime_put_noidle(&pdev->dev);
+ pm_runtime_set_suspended(&pdev->dev);
return 0;
}
The current approach to gate the clock in ->remove() relies on CONFIG_PM to be set, as it's expected that the call to pm_runtime_put_sync() triggers the ->runtime_suspend() callback to be invoked. Even in the case when CONFIG_PM is set, userspace may prevent runtime PM suspend via sysfs (pm_runtime_forbid()) for the device. Fix the behaviour by converting from using pm_runtime_put_sync() into directly using the clk API to manage clock gating. Let's also update the runtime PM status for the device as to reflect the state of the HW. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> --- drivers/i2c/busses/i2c-designware-platdrv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 1.9.1