Skip to content

Commit

Permalink
PM / Domains: Take .power_off() error code into account
Browse files Browse the repository at this point in the history
Currently pm_genpd_poweroff() discards error codes returned by
the PM domain's .power_off() callback, because it's safer to always
regard the domain as inaccessible to drivers after a failing
.power_off().  Still, there are situations in which the low-level
code may want to indicate that it doesn't want to power off the
domain, so allow it to do that by returning -EBUSY from .power_off().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Magnus Damm <damm@opensource.se>
  • Loading branch information
Rafael J. Wysocki committed Jul 14, 2011
1 parent 0bc5b2d commit d280540
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,16 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd)
}
}

if (genpd->power_off)
genpd->power_off(genpd);
if (genpd->power_off) {
ret = genpd->power_off(genpd);
if (ret == -EBUSY) {
genpd_set_active(genpd);
if (parent)
genpd_release_lock(parent);

goto out;
}
}

genpd->status = GPD_STATE_POWER_OFF;

Expand Down

0 comments on commit d280540

Please sign in to comment.