]> git.baikalelectronics.ru Git - kernel.git/commit
PM: runtime: Do not call __rpm_callback() from rpm_idle()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 2 Dec 2022 14:30:28 +0000 (15:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:40:57 +0000 (11:40 +0100)
commit43be0e71f915c8c1bf0962a0b28a91ed49a08008
tree1ca0caf2d8016ebdf8328dbfce1c3a5d5884ef8b
parent0bb04bc4ce06c3827031e7d850066e03df22a73c
PM: runtime: Do not call __rpm_callback() from rpm_idle()

[ Upstream commit bc80c2e438dcbfcf748452ec0f7ad5b79ff3ad88 ]

Calling __rpm_callback() from rpm_idle() after adding device links
support to the former is a clear mistake.

Not only it causes rpm_idle() to carry out unnecessary actions, but it
is also against the assumption regarding the stability of PM-runtime
status across __rpm_callback() invocations, because rpm_suspend() and
rpm_resume() may run in parallel with __rpm_callback() when it is called
by rpm_idle() and the device's PM-runtime status can be updated by any
of them.

Fixes: 4c7e7b6bd1f7 ("PM / runtime: Use device links")
Link: https://lore.kernel.org/linux-pm/36aed941-a73e-d937-2721-4f0decd61ce0@quicinc.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/power/runtime.c