Commit f34a0676 authored by Ulf Hansson's avatar Ulf Hansson
Browse files

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: default avatarAbel Vesa <abel.vesa@linaro.org>
Tested-by: default avatarTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20250417142513.312939-3-ulf.hansson@linaro.org
parent 0e3b6672
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -917,19 +917,13 @@ 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) ||
	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;