pmdomain: arm: scmi_pm_domain: Remove redundant state verification
authorSudeep Holla <sudeep.holla@arm.com>
Fri, 14 Mar 2025 09:58:51 +0000 (09:58 +0000)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 17 Mar 2025 10:12:01 +0000 (11:12 +0100)
Currently, scmi_pd_power() explicitly verifies whether the requested
power state was applied by calling state_get(). While this check could
detect failures where the state was not properly updated, ensuring
correctness is the responsibility of the SCMI firmware.

Removing this redundant state_get() call eliminates an unnecessary
round-trip to the firmware, improving efficiency. Any mismatches
between the requested and actual states should be handled by the SCMI
firmware, which must return a failure if state_set() is unsuccessful.

Additionally, in some cases, checking the state after powering off a
domain may be unreliable or unsafe, depending on the firmware
implementation.

This patch removes the redundant verification, simplifying the function
without compromising correctness.

Reported-and-tested-by: Ranjani Vaidyanathan <ranjani.vaidyanathan@nxp.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20250314095851.443979-1-sudeep.holla@arm.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/pmdomain/arm/scmi_pm_domain.c

index 86b531e15b85436b85f25e6faefdc6f1cc3cc4d9..2a213c218126ea08854d13e588f28497a35813c2 100644 (file)
@@ -24,8 +24,7 @@ struct scmi_pm_domain {
 
 static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on)
 {
-       int ret;
-       u32 state, ret_state;
+       u32 state;
        struct scmi_pm_domain *pd = to_scmi_pd(domain);
 
        if (power_on)
@@ -33,13 +32,7 @@ static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on)
        else
                state = SCMI_POWER_STATE_GENERIC_OFF;
 
-       ret = power_ops->state_set(pd->ph, pd->domain, state);
-       if (!ret)
-               ret = power_ops->state_get(pd->ph, pd->domain, &ret_state);
-       if (!ret && state != ret_state)
-               return -EIO;
-
-       return ret;
+       return power_ops->state_set(pd->ph, pd->domain, state);
 }
 
 static int scmi_pd_power_on(struct generic_pm_domain *domain)