diff mbox series

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

Message ID 20230522063325.80193-3-wyes.karny@amd.com (mailing list archive)
State Superseded, archived
Headers show
Series amd-pstate: amd_pstate related fixes | expand

Commit Message

Wyes Karny May 22, 2023, 6:33 a.m. UTC
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@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Yuan, Perry May 22, 2023, 7:27 a.m. UTC | #1
[AMD Official Use Only - General]

Hi Wyse.

> -----Original Message-----
> From: Karny, Wyes <Wyes.Karny@amd.com>
> Sent: Monday, May 22, 2023 2:33 PM
> To: Huang, Ray <Ray.Huang@amd.com>; rafael@kernel.org;
> viresh.kumar@linaro.org
> Cc: Limonciello, Mario <Mario.Limonciello@amd.com>; Jinzhou.Su@amd.com;
> Yuan, Perry <Perry.Yuan@amd.com>; linux-pm@vger.kernel.org; linux-
> kernel@vger.kernel.org; Karny, Wyes <Wyes.Karny@amd.com>
> Subject: [PATCH 2/2] cpufreq/amd-pstate: Remove unnecessary active state
> checks
> 
> 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@amd.com>
> ---
>  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;
> 

Thanks for your patch to improve the pstate driver. 
Have you tested the online and offline callback can work for non-epp modes ?
If the callback works well, glad to add the review by for the patch.

Perry. 

>  	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
diff mbox series

Patch

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;