Skip to content

Commit f34a067

Browse files
committed
pmdomain: core: Simplify return statement in genpd_power_off()
Rather than using two if-clauses immediately after each to check for similar reasons to prevent the power-off, let's combine them into one if-clause to simplify the code. Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250417142513.312939-3-ulf.hansson@linaro.org
1 parent 0e3b667 commit f34a067

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

drivers/pmdomain/core.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -917,20 +917,14 @@ static void genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
917917

918918
/*
919919
* Do not try to power off the domain in the following situations:
920-
* (1) The domain is already in the "power off" state.
921-
* (2) System suspend is in progress.
920+
* The domain is already in the "power off" state.
921+
* System suspend is in progress.
922+
* The domain is configured as always on.
923+
* The domain has a subdomain being powered on.
922924
*/
923-
if (!genpd_status_on(genpd) || genpd->prepared_count > 0)
924-
return;
925-
926-
/*
927-
* Abort power off for the PM domain in the following situations:
928-
* (1) The domain is configured as always on.
929-
* (2) When the domain has a subdomain being powered on.
930-
*/
931-
if (genpd_is_always_on(genpd) ||
932-
genpd_is_rpm_always_on(genpd) ||
933-
atomic_read(&genpd->sd_count) > 0)
925+
if (!genpd_status_on(genpd) || genpd->prepared_count > 0 ||
926+
genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd) ||
927+
atomic_read(&genpd->sd_count) > 0)
934928
return;
935929

936930
/*

0 commit comments

Comments
 (0)