]> git.baikalelectronics.ru Git - kernel.git/commit
PM / Domains: Fix genpd to deal with drivers returning 1 from ->prepare()
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 8 Nov 2017 09:11:02 +0000 (10:11 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 8 Nov 2017 11:16:57 +0000 (12:16 +0100)
commit8f631ca01ce84cbb9e0020ae94812fa4b38cea7d
tree5b427f946ad914c48be94926fb4e51d9025b3b1d
parent015d53afc179e2dc1107b85da9f33bf84bef31e2
PM / Domains: Fix genpd to deal with drivers returning 1 from ->prepare()

During system-wide PM, genpd relies on its PM callbacks to be invoked for
all its attached devices, as to deal with powering off/on the PM domain. In
other words, genpd is not compatible with the direct_complete path, if
executed by the PM core for any of its attached devices.

However, when genpd's ->prepare() callback invokes pm_generic_prepare(), it
does not take into account that it may return 1. Instead it treats that as
an error internally and expects the PM core to abort the prepare phase and
roll back. This leads to genpd not properly powering on/off the PM domain,
because its internal counters gets wrongly balanced.

To fix the behaviour, allow drivers to return 1 from their ->prepare()
callbacks, but let's return 0 from genpd's ->prepare() callback in such
case, as that prevents the PM core from running the direct_complete path
for the device.

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