Skip to content

Commit b6e224e

Browse files
rafaeljwaloktiwa
authored andcommitted
PM: sleep: Fix power.is_suspended cleanup for direct-complete devices
[ Upstream commit d46c4c839c20a599a0eb8d73708ce401f9c7d06d ] Commit 03f1444 ("PM: sleep: Fix handling devices with direct_complete set on errors") caused power.is_suspended to be set for devices with power.direct_complete set, but it forgot to ensure the clearing of that flag for them in device_resume(), so power.is_suspended is still set for them during the next system suspend-resume cycle. If that cycle is aborted in dpm_suspend(), the subsequent invocation of dpm_resume() will trigger a device_resume() call for every device and because power.is_suspended is set for the devices in question, they will not be skipped by device_resume() as expected which causes scary error messages to be logged (as appropriate). To address this issue, move the clearing of power.is_suspended in device_resume() immediately after the power.is_suspended check so it will be always cleared for all devices processed by that function. Fixes: 03f1444 ("PM: sleep: Fix handling devices with direct_complete set on errors") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4280 Reported-and-tested-by: Chris Bainbridge <chris.bainbridge@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patch.msgid.link/4990586.GXAFRqVoOG@rjwysocki.net Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 36d91620a62e43171aae64df4cb9823bf0d9a256) FOF: 0825 Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
1 parent f87d319 commit b6e224e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/base/power/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,8 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
971971
if (!dev->power.is_suspended)
972972
goto Complete;
973973

974+
dev->power.is_suspended = false;
975+
974976
if (dev->power.direct_complete) {
975977
/* Match the pm_runtime_disable() in __device_suspend(). */
976978
pm_runtime_enable(dev);
@@ -1026,7 +1028,6 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
10261028

10271029
End:
10281030
error = dpm_run_callback(callback, dev, state, info);
1029-
dev->power.is_suspended = false;
10301031

10311032
device_unlock(dev);
10321033
dpm_watchdog_clear(&wd);

0 commit comments

Comments
 (0)