Skip to content

Commit ef3fe57

Browse files
digetxwsakernel
authored andcommitted
i2c: tegra: Ensure that device is suspended before driver is removed
Tegra I2C device isn't guaranteed to be suspended after removal of the driver since driver uses pm_runtime_put() that is asynchronous and pm_runtime_disable() cancels pending power-change requests. This means that potentially refcount of the clocks may become unbalanced after removal of the driver. This a very minor problem which unlikely to happen in practice and won't cause any visible problems, nevertheless let's replace pm_runtime_disable() with pm_runtime_force_suspend() and use pm_runtime_put_sync() which disables RPM of the device and puts it into suspend before driver is removed. Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent e4f2647 commit ef3fe57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-tegra.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ static int tegra_i2c_init_hardware(struct tegra_i2c_dev *i2c_dev)
17001700
else
17011701
ret = tegra_i2c_init(i2c_dev);
17021702

1703-
pm_runtime_put(i2c_dev->dev);
1703+
pm_runtime_put_sync(i2c_dev->dev);
17041704

17051705
return ret;
17061706
}
@@ -1819,7 +1819,7 @@ static int tegra_i2c_remove(struct platform_device *pdev)
18191819
struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);
18201820

18211821
i2c_del_adapter(&i2c_dev->adapter);
1822-
pm_runtime_disable(i2c_dev->dev);
1822+
pm_runtime_force_suspend(i2c_dev->dev);
18231823

18241824
tegra_i2c_release_dma(i2c_dev);
18251825
tegra_i2c_release_clocks(i2c_dev);

0 commit comments

Comments
 (0)