From: Abel Vesa <abel.vesa@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Saravana Kannan <saravanak@google.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-pm@vger.kernel.org,
"Rafael J . Wysocki" <rafael@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Michael Grzeschik <m.grzeschik@pengutronix.de>,
Bjorn Andersson <andersson@kernel.org>,
Devarsh Thakkar <devarsht@lewv0571a.ent.ti.com>,
Peng Fan <peng.fan@oss.nxp.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Johan Hovold <johan@kernel.org>,
Maulik Shah <maulik.shah@oss.qualcomm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/11] pmdomain: core: Convert genpd_power_off() to void
Date: Tue, 22 Apr 2025 16:27:38 +0300 [thread overview]
Message-ID: <aAeZSmRtVyxEzqvC@linaro.org> (raw)
In-Reply-To: <20250417142513.312939-2-ulf.hansson@linaro.org>
On 25-04-17 16:24:59, Ulf Hansson wrote:
> At some point it made sense to have genpd_power_off() to return an error
> code. That hasn't been the case for quite some time, so let's convert it
> into a static void function and simplify some of the corresponding code.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
> ---
> drivers/pmdomain/core.c | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 3523d0331cec..574a0de1696a 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -908,13 +908,12 @@ static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> * If all of the @genpd's devices have been suspended and all of its subdomains
> * have been powered down, remove power from @genpd.
> */
> -static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> - unsigned int depth)
> +static void genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> + unsigned int depth)
> {
> 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:
> @@ -922,7 +921,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> * (2) System suspend is in progress.
> */
> if (!genpd_status_on(genpd) || genpd->prepared_count > 0)
> - return 0;
> + return;
>
> /*
> * Abort power off for the PM domain in the following situations:
> @@ -932,7 +931,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> if (genpd_is_always_on(genpd) ||
> genpd_is_rpm_always_on(genpd) ||
> atomic_read(&genpd->sd_count) > 0)
> - return -EBUSY;
> + return;
>
> /*
> * The children must be in their deepest (powered-off) states to allow
> @@ -943,7 +942,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> list_for_each_entry(link, &genpd->parent_links, parent_node) {
> struct generic_pm_domain *child = link->child;
> if (child->state_idx < child->state_count - 1)
> - return -EBUSY;
> + return;
> }
>
> list_for_each_entry(pdd, &genpd->dev_list, list_node) {
> @@ -957,15 +956,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
>
> /* The device may need its PM domain to stay powered on. */
> if (to_gpd_data(pdd)->rpm_always_on)
> - return -EBUSY;
> + return;
> }
>
> if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on))
> - return -EBUSY;
> + return;
>
> if (genpd->gov && genpd->gov->power_down_ok) {
> if (!genpd->gov->power_down_ok(&genpd->domain))
> - return -EAGAIN;
> + return;
> }
>
> /* Default to shallowest state. */
> @@ -974,12 +973,11 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
>
> /* Don't power off, if a child domain is waiting to power on. */
> if (atomic_read(&genpd->sd_count) > 0)
> - return -EBUSY;
> + return;
>
> - ret = _genpd_power_off(genpd, true);
> - if (ret) {
> + if (_genpd_power_off(genpd, true)) {
> genpd->states[genpd->state_idx].rejected++;
> - return ret;
> + return;
> }
>
> genpd->status = GENPD_STATE_OFF;
> @@ -992,8 +990,6 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
> genpd_power_off(link->parent, false, depth + 1);
> genpd_unlock(link->parent);
> }
> -
> - return 0;
> }
>
> /**
> --
> 2.43.0
>
next prev parent reply other threads:[~2025-04-22 13:27 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-17 14:24 [PATCH 00/11] pmdomain: Add generic ->sync_state() support to genpd Ulf Hansson
2025-04-17 14:24 ` [PATCH 01/11] pmdomain: core: Convert genpd_power_off() to void Ulf Hansson
2025-04-22 13:27 ` Abel Vesa [this message]
2025-04-17 14:25 ` [PATCH 02/11] pmdomain: core: Simplify return statement in genpd_power_off() Ulf Hansson
2025-04-22 13:28 ` Abel Vesa
2025-04-17 14:25 ` [PATCH 03/11] pmdomain: core: Use genpd->opp_table to simplify error/remove path Ulf Hansson
2025-04-22 13:33 ` Abel Vesa
2025-04-17 14:25 ` [PATCH 04/11] pmdomain: core: Add a bus and a driver for genpd providers Ulf Hansson
2025-04-22 14:02 ` Abel Vesa
2025-04-23 7:34 ` Ulf Hansson
2025-04-17 14:25 ` [PATCH 05/11] pmdomain: core: Use device_set_node() to assign the fwnode too Ulf Hansson
2025-04-17 20:55 ` Saravana Kannan
2025-04-23 7:30 ` Ulf Hansson
2025-04-22 14:04 ` Abel Vesa
2025-04-17 14:25 ` [PATCH 06/11] pmdomain: core: Add the genpd->dev to the genpd provider bus Ulf Hansson
2025-04-22 14:06 ` Abel Vesa
2025-04-17 14:25 ` [PATCH 07/11] pmdomain: core: Export a common ->sync_state() helper for genpd providers Ulf Hansson
2025-04-22 14:10 ` Abel Vesa
2025-05-07 16:23 ` Dan Carpenter
2025-05-08 10:05 ` Ulf Hansson
2025-04-17 14:25 ` [PATCH 08/11] pmdomain: core: Add internal ->sync_state() support " Ulf Hansson
2025-04-18 0:23 ` Saravana Kannan
2025-04-23 7:58 ` Ulf Hansson
2025-04-17 14:25 ` [PATCH 09/11] driver core: Add dev_set_drv_sync_state() Ulf Hansson
2025-04-22 14:15 ` Abel Vesa
2025-04-17 14:25 ` [PATCH 10/11] pmdomain: core: Default to use of_genpd_sync_state() for genpd providers Ulf Hansson
2025-04-18 0:29 ` Saravana Kannan
2025-04-17 14:25 ` [PATCH 11/11] pmdomain: core: Leave powered-on genpds on until ->sync_state() Ulf Hansson
2025-04-18 0:50 ` Saravana Kannan
2025-04-23 7:46 ` Ulf Hansson
2025-04-18 0:53 ` [PATCH 00/11] pmdomain: Add generic ->sync_state() support to genpd Saravana Kannan
2025-04-24 10:59 ` Tomi Valkeinen
2025-04-25 12:17 ` Ulf Hansson
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=aAeZSmRtVyxEzqvC@linaro.org \
--to=abel.vesa@linaro.org \
--cc=andersson@kernel.org \
--cc=devarsht@lewv0571a.ent.ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=m.grzeschik@pengutronix.de \
--cc=maulik.shah@oss.qualcomm.com \
--cc=peng.fan@oss.nxp.com \
--cc=rafael@kernel.org \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=tomi.valkeinen@ideasonboard.com \
--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