Skip to content

Commit 6cf5db7

Browse files
sudeep-hollastorulf
authored andcommitted
pmdomain: arm: scmi_pm_domain: Remove redundant state verification
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>
1 parent 6ec7c4a commit 6cf5db7

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/pmdomain/arm/scmi_pm_domain.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,15 @@ struct scmi_pm_domain {
2424

2525
static int scmi_pd_power(struct generic_pm_domain *domain, bool power_on)
2626
{
27-
int ret;
28-
u32 state, ret_state;
27+
u32 state;
2928
struct scmi_pm_domain *pd = to_scmi_pd(domain);
3029

3130
if (power_on)
3231
state = SCMI_POWER_STATE_GENERIC_ON;
3332
else
3433
state = SCMI_POWER_STATE_GENERIC_OFF;
3534

36-
ret = power_ops->state_set(pd->ph, pd->domain, state);
37-
if (!ret)
38-
ret = power_ops->state_get(pd->ph, pd->domain, &ret_state);
39-
if (!ret && state != ret_state)
40-
return -EIO;
41-
42-
return ret;
35+
return power_ops->state_set(pd->ph, pd->domain, state);
4336
}
4437

4538
static int scmi_pd_power_on(struct generic_pm_domain *domain)

0 commit comments

Comments
 (0)