From: Ulf Hansson Date: Tue, 26 Apr 2016 06:47:17 +0000 (+0200) Subject: UPSTREAM: PM / Domains: Remove redundant pm_runtime_get|put*() in pm_genpd_prepare() X-Git-Tag: firefly_0821_release~650 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;ds=sidebyside;h=1f3ffafad8168eaf04948533b28fd6c0d8721e1c;p=firefly-linux-kernel-4.4.55.git UPSTREAM: PM / Domains: Remove redundant pm_runtime_get|put*() in pm_genpd_prepare() The PM core increases and decreases the runtime PM usage count in the system PM prepare phase. This makes some of the pm_runtime_get|put*() calls in pm_genpd_prepare() redundant, so let's remove them. Signed-off-by: Ulf Hansson Reviewed-by: Kevin Hilman Reviewed-by: Laurent Pinchart Reviewed-by: Laurent Pinchart Signed-off-by: Rafael J. Wysocki (cherry picked from commit 624c8df7d2823ec0df9609025480309322886ed3) Change-Id: I0e9a2027740147ef6674993039062d2c3cb2513a Signed-off-by: Elaine Zhang --- diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 5decc295def4..e36c01c8b067 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -688,14 +688,11 @@ static int pm_genpd_prepare(struct device *dev) * at this point and a system wakeup event should be reported if it's * set up to wake up the system from sleep states. */ - pm_runtime_get_noresume(dev); if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) pm_wakeup_event(dev, 0); - if (pm_wakeup_pending()) { - pm_runtime_put(dev); + if (pm_wakeup_pending()) return -EBUSY; - } if (resume_needed(dev, genpd)) pm_runtime_resume(dev); @@ -709,10 +706,8 @@ static int pm_genpd_prepare(struct device *dev) mutex_unlock(&genpd->lock); - if (genpd->suspend_power_off) { - pm_runtime_put_noidle(dev); + if (genpd->suspend_power_off) return 0; - } /* * The PM domain must be in the GPD_STATE_ACTIVE state at this point, @@ -734,7 +729,6 @@ static int pm_genpd_prepare(struct device *dev) pm_runtime_enable(dev); } - pm_runtime_put(dev); return ret; }