PM / core: Assign the wakeup_path status flag in __device_prepare()
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 2 Jan 2018 16:08:50 +0000 (17:08 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 9 Jan 2018 12:09:16 +0000 (13:09 +0100)
commit8512220c5782d3e469cf8127a612a6c8f521e2dc
treec5319dcab99ae1a6d3519c272a4dd6801f955d26
parent7bf4e594c28afc67bc120a380ca774e43ca496d8
PM / core: Assign the wakeup_path status flag in __device_prepare()

The PM core in the device_prepare() phase, resets the wakeup_path status
flag to the value of device_may_wakeup(). This means if a ->prepare() or a
->suspend() callback for the device would update the device's wakeup
setting, this doesn't become reflected in the wakeup_path status flag.

In general this isn't a problem, because wakeup settings are not supposed
to be changed (via for example calling device_set_wakeup_enable()) during
any system wide suspend/resume phase.  Nevertheless there are some users,
which can be considered as legacy, that don't conform to this behaviour.

These legacy cases should be corrected, however until that is done, let's
address the issue from the PM core, by moving the assignment of the
wakeup_path status flag to the __device_suspend() phase and after the
->suspend() callback has been invoked.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/power/main.c