summaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-04-10 11:55:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-05-31 06:46:23 -0700
commitcbaab786ee67caf36b30bc10e2a3d6cd34a66500 (patch)
treed22826d628f4fd4a919c6c480684fc16ea6fecae /drivers/base/power
parentd8a36f8418034bacef0b5b73c0822f41646d77ba (diff)
downloadlinux-stable-cbaab786ee67caf36b30bc10e2a3d6cd34a66500.tar.gz
linux-stable-cbaab786ee67caf36b30bc10e2a3d6cd34a66500.tar.bz2
linux-stable-cbaab786ee67caf36b30bc10e2a3d6cd34a66500.zip
PM / core: Propagate dev->power.wakeup_path when no callbacks
[ Upstream commit dc351d4c5f4fe4d0f274d6d660227be0c3a03317 ] The dev->power.direct_complete flag may become set in device_prepare() in case the device don't have any PM callbacks (dev->power.no_pm_callbacks is set). This leads to a broken behaviour, when there is child having wakeup enabled and relies on its parent to be used in the wakeup path. More precisely, when the direct complete path becomes selected for the child in __device_suspend(), the propagation of the dev->power.wakeup_path becomes skipped as well. Let's address this problem, by checking if the device is a part the wakeup path or has wakeup enabled, then prevent the direct complete path from being used. Reported-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> [ rjw: Comment cleanup ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index a690fd400260..4abd7c6531d9 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1736,6 +1736,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
if (dev->power.syscore)
goto Complete;
+ /* Avoid direct_complete to let wakeup_path propagate. */
+ if (device_may_wakeup(dev) || dev->power.wakeup_path)
+ dev->power.direct_complete = false;
+
if (dev->power.direct_complete) {
if (pm_runtime_status_suspended(dev)) {
pm_runtime_disable(dev);