i2c: tegra: Ensure that device is suspended before driver is removed
authorDmitry Osipenko <digetx@gmail.com>
Tue, 19 Oct 2021 23:29:19 +0000 (02:29 +0300)
committerWolfram Sang <wsa@kernel.org>
Fri, 29 Oct 2021 19:51:31 +0000 (21:51 +0200)
commitef3fe574d49eda31e1d13bfbd19da64b46fb004e
treebfe7353bd4e859b1f6727cd7750c67a5b1a43857
parente4f2647585d0822ab52bc40c0669e8339a05212f
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 <digetx@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-tegra.c