]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
pmdomain: core: Simplify return statement in genpd_power_off()
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 17 Apr 2025 14:25:00 +0000 (16:25 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 2 May 2025 10:34:01 +0000 (12:34 +0200)
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
drivers/pmdomain/core.c

index 436630bf7d7f63939a50231a57743bda6e6d887b..25aa229374c0d11e78426a69613c4ab038c8ca40 100644 (file)
@@ -917,20 +917,14 @@ static void genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
 
        /*
         * Do not try to power off the domain in the following situations:
-        * (1) The domain is already in the "power off" state.
-        * (2) System suspend is in progress.
+        * The domain is already in the "power off" state.
+        * System suspend is in progress.
+        * The domain is configured as always on.
+        * The domain has a subdomain being powered on.
         */
-       if (!genpd_status_on(genpd) || genpd->prepared_count > 0)
-               return;
-
-       /*
-        * Abort power off for the PM domain in the following situations:
-        * (1) The domain is configured as always on.
-        * (2) When the domain has a subdomain being powered on.
-        */
-       if (genpd_is_always_on(genpd) ||
-                       genpd_is_rpm_always_on(genpd) ||
-                       atomic_read(&genpd->sd_count) > 0)
+       if (!genpd_status_on(genpd) || genpd->prepared_count > 0 ||
+           genpd_is_always_on(genpd) || genpd_is_rpm_always_on(genpd) ||
+           atomic_read(&genpd->sd_count) > 0)
                return;
 
        /*