[PATCH 2/2] cpufreq/amd-pstate: Remove unnecessary active state checks

From: Wyes Karny
Date: Mon May 22 2023 - 02:35:21 EST


Some functions are only specific to amd_pstate active mode driver. This
functions cannot be called from passive/guided mode paths, therefore
remove these unnecessary checks.

Fixes: d4da12f8033a ("cpufreq: amd-pstate: implement amd pstate cpu online and offline callback")
Fixes: 50ddd2f78269 ("cpufreq: amd-pstate: implement suspend and resume callbacks")

Signed-off-by: Wyes Karny <wyes.karny@xxxxxxx>
---
drivers/cpufreq/amd-pstate.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 8c72f95ac315..fda66a206d26 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -1209,10 +1209,8 @@ static int amd_pstate_epp_cpu_online(struct cpufreq_policy *policy)

pr_debug("AMD CPU Core %d going online\n", cpudata->cpu);

- if (cppc_state == AMD_PSTATE_ACTIVE) {
- amd_pstate_epp_reenable(policy->cpu, cpudata);
- cpudata->suspended = false;
- }
+ amd_pstate_epp_reenable(policy->cpu, cpudata);
+ cpudata->suspended = false;

return 0;
}
@@ -1255,8 +1253,7 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
if (cpudata->suspended)
return 0;

- if (cppc_state == AMD_PSTATE_ACTIVE)
- amd_pstate_epp_offline(policy);
+ amd_pstate_epp_offline(policy);

return 0;
}
@@ -1273,10 +1270,6 @@ static int amd_pstate_epp_suspend(struct cpufreq_policy *policy)
struct amd_cpudata *cpudata = policy->driver_data;
int ret;

- /* avoid suspending when EPP is not enabled */
- if (cppc_state != AMD_PSTATE_ACTIVE)
- return 0;
-
/* set this flag to avoid setting core offline*/
cpudata->suspended = true;

--
2.34.1