Commit f63816e4 authored by Ulf Hansson's avatar Ulf Hansson Committed by Rafael J. Wysocki

PM: domains: Allow to abort power off when no ->power_off() callback

In genpd_power_off() we may decide to abort the power off of the PM domain,
even beyond the point when the governor would accept it. The abort is done
if it turns out that a child domain has been requested to be powered on,
which means it's waiting for the lock of the parent to be released.

However, the abort is currently only considered if the genpd in question
has a ->power_off() callback assigned. This is unnecessary limiting,
especially if the genpd would have a parent of its own. Let's remove the
limitation and make the behaviour consistent.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
[ rjw: Subject edit ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 49f618e1
...@@ -497,6 +497,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, ...@@ -497,6 +497,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
struct pm_domain_data *pdd; struct pm_domain_data *pdd;
struct gpd_link *link; struct gpd_link *link;
unsigned int not_suspended = 0; unsigned int not_suspended = 0;
int ret;
/* /*
* Do not try to power off the domain in the following situations: * Do not try to power off the domain in the following situations:
...@@ -544,24 +545,13 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, ...@@ -544,24 +545,13 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
if (!genpd->gov) if (!genpd->gov)
genpd->state_idx = 0; genpd->state_idx = 0;
if (genpd->power_off) { /* Don't power off, if a child domain is waiting to power on. */
int ret; if (atomic_read(&genpd->sd_count) > 0)
return -EBUSY;
if (atomic_read(&genpd->sd_count) > 0)
return -EBUSY;
/* ret = _genpd_power_off(genpd, true);
* If sd_count > 0 at this point, one of the subdomains hasn't if (ret)
* managed to call genpd_power_on() for the parent yet after return ret;
* incrementing it. In that case genpd_power_on() will wait
* for us to drop the lock, so we can call .power_off() and let
* the genpd_power_on() restore power for us (this shouldn't
* happen very often).
*/
ret = _genpd_power_off(genpd, true);
if (ret)
return ret;
}
genpd->status = GENPD_STATE_OFF; genpd->status = GENPD_STATE_OFF;
genpd_update_accounting(genpd); genpd_update_accounting(genpd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment