From: Aisheng Dong <aisheng.dong@nxp.com>
To: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>
Cc: Aisheng Dong <aisheng.dong@nxp.com>,
"ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
"dongas86@gmail.com" <dongas86@gmail.com>,
"khilman@kernel.org" <khilman@kernel.org>,
"rjw@rjwysocki.net" <rjw@rjwysocki.net>,
dl-linux-imx <linux-imx@nxp.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH 4/6] PM / Domains: Move the Subdomain check into _genpd_power_off
Date: Wed, 6 Mar 2019 13:25:22 +0000 [thread overview]
Message-ID: <1551878302-8146-5-git-send-email-aisheng.dong@nxp.com> (raw)
In-Reply-To: <1551878302-8146-1-git-send-email-aisheng.dong@nxp.com>
Move the Subdomain check into _genpd_power_off, then the caller does
not have to check it each time. This also ensures a double check
of &genpd->sd_count before really power off domain in case it's
increased asynchronously by subdomains. This is the same behavior
as the original genpd_power_off() does.
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
drivers/base/power/domain.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 591f37f..61cd500 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -452,6 +452,9 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
if (!genpd->power_off)
return 0;
+ if (atomic_read(&genpd->sd_count) > 0)
+ return -EBUSY;
+
if (!timed)
return genpd->power_off(genpd);
@@ -547,9 +550,6 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
if (!genpd->gov)
genpd->state_idx = 0;
- 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
@@ -962,8 +962,7 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
if (!genpd_status_on(genpd) || genpd_is_always_on(genpd))
return;
- if (genpd->suspended_count != genpd->device_count
- || atomic_read(&genpd->sd_count) > 0)
+ if (genpd->suspended_count != genpd->device_count)
return;
/* Choose the deepest state when suspending */
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-06 13:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 13:25 [PATCH 0/6] PM / Domains: A few clean up and minor fixes Aisheng Dong
2019-03-06 13:25 ` [PATCH 1/6] PM / Domains: Improve warn for multiple states but no governor in genpd Aisheng Dong
2019-03-06 14:17 ` Ulf Hansson
2019-03-07 13:57 ` Aisheng Dong
2019-03-06 13:25 ` [PATCH 2/6] PM / Domains: Return for all error cases in _genpd_power_off Aisheng Dong
2019-03-06 14:17 ` Ulf Hansson
2019-03-06 13:25 ` [PATCH 3/6] PM / Domains: Remove the unnecessary ->power_off() check in genpd_power_off Aisheng Dong
2019-03-06 13:25 ` Aisheng Dong [this message]
2019-03-06 14:26 ` [PATCH 4/6] PM / Domains: Move the Subdomain check into _genpd_power_off Ulf Hansson
2019-03-06 14:47 ` Aisheng Dong
2019-03-06 13:25 ` [PATCH 5/6] PM / QoS: Fix a typo in file description Aisheng Dong
2019-03-06 13:25 ` [PATCH 6/6] PM / domains: Remove one unnecessary blank line Aisheng Dong
2019-03-06 14:29 ` Ulf Hansson
2019-03-12 9:38 ` [PATCH 0/6] PM / Domains: A few clean up and minor fixes Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1551878302-8146-5-git-send-email-aisheng.dong@nxp.com \
--to=aisheng.dong@nxp.com \
--cc=dongas86@gmail.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).