diff mbox series

[3/6] PM / Domains: Remove the unnecessary ->power_off() check in genpd_power_off

Message ID 1551878302-8146-4-git-send-email-aisheng.dong@nxp.com (mailing list archive)
State Changes Requested, archived
Headers show
Series PM / Domains: A few clean up and minor fixes | expand

Commit Message

Aisheng Dong March 6, 2019, 1:25 p.m. UTC
There's already a check in _genpd_power_off, so caller can directly call it
without checking.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/base/power/domain.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index f012576..591f37f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -501,6 +501,7 @@  static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
 	struct pm_domain_data *pdd;
 	struct gpd_link *link;
 	unsigned int not_suspended = 0;
+	int ret;
 
 	/*
 	 * Do not try to power off the domain in the following situations:
@@ -546,24 +547,20 @@  static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
 	if (!genpd->gov)
 		genpd->state_idx = 0;
 
-	if (genpd->power_off) {
-		int ret;
-
-		if (atomic_read(&genpd->sd_count) > 0)
-			return -EBUSY;
+	if (atomic_read(&genpd->sd_count) > 0)
+		return -EBUSY;
 
-		/*
-		 * If sd_count > 0 at this point, one of the subdomains hasn't
-		 * managed to call genpd_power_on() for the master yet after
-		 * 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;
-	}
+	/*
+	 * If sd_count > 0 at this point, one of the subdomains hasn't
+	 * managed to call genpd_power_on() for the master yet after
+	 * 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 = GPD_STATE_POWER_OFF;
 	genpd_update_accounting(genpd);