[PATCH v2 1/2] cpufreq/amd-pstate: Remove the redundant verify() function

Dhananjay Ugwekar posted 2 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH v2 1/2] cpufreq/amd-pstate: Remove the redundant verify() function
Posted by Dhananjay Ugwekar 1 month, 1 week ago
Merge the two verify() callback functions and rename the
cpufreq_policy_data argument for better readability.

Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
---
 drivers/cpufreq/amd-pstate.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index b7a17a3ef122..fa16d72d6058 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -527,10 +527,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	cpufreq_cpu_put(policy);
 }
 
-static int amd_pstate_verify(struct cpufreq_policy_data *policy)
+static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
 {
-	cpufreq_verify_within_cpu_limits(policy);
-
+	cpufreq_verify_within_cpu_limits(policy_data);
+	pr_debug("policy_max =%d, policy_min=%d\n", policy_data->max, policy_data->min);
 	return 0;
 }
 
@@ -1661,13 +1661,6 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
 	return 0;
 }
 
-static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy)
-{
-	cpufreq_verify_within_cpu_limits(policy);
-	pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min);
-	return 0;
-}
-
 static int amd_pstate_epp_suspend(struct cpufreq_policy *policy)
 {
 	struct amd_cpudata *cpudata = policy->driver_data;
@@ -1723,7 +1716,7 @@ static struct cpufreq_driver amd_pstate_driver = {
 
 static struct cpufreq_driver amd_pstate_epp_driver = {
 	.flags		= CPUFREQ_CONST_LOOPS,
-	.verify		= amd_pstate_epp_verify_policy,
+	.verify		= amd_pstate_verify,
 	.setpolicy	= amd_pstate_epp_set_policy,
 	.init		= amd_pstate_epp_cpu_init,
 	.exit		= amd_pstate_epp_cpu_exit,
-- 
2.34.1
Re: [PATCH v2 1/2] cpufreq/amd-pstate: Remove the redundant verify() function
Posted by Gautham R. Shenoy 1 month, 1 week ago
Hello Dhananjay,

On Wed, Oct 16, 2024 at 02:46:40PM +0000, Dhananjay Ugwekar wrote:
> Merge the two verify() callback functions and rename the
> cpufreq_policy_data argument for better readability.

Thanks for cleaning this up.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>

--
Thanks and Regards
gautham.

> 
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index b7a17a3ef122..fa16d72d6058 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -527,10 +527,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
>  	cpufreq_cpu_put(policy);
>  }
>  
> -static int amd_pstate_verify(struct cpufreq_policy_data *policy)
> +static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
>  {
> -	cpufreq_verify_within_cpu_limits(policy);
> -
> +	cpufreq_verify_within_cpu_limits(policy_data);
> +	pr_debug("policy_max =%d, policy_min=%d\n", policy_data->max, policy_data->min);
>  	return 0;
>  }
>  
> @@ -1661,13 +1661,6 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
>  	return 0;
>  }
>  
> -static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy)
> -{
> -	cpufreq_verify_within_cpu_limits(policy);
> -	pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min);
> -	return 0;
> -}
> -
>  static int amd_pstate_epp_suspend(struct cpufreq_policy *policy)
>  {
>  	struct amd_cpudata *cpudata = policy->driver_data;
> @@ -1723,7 +1716,7 @@ static struct cpufreq_driver amd_pstate_driver = {
>  
>  static struct cpufreq_driver amd_pstate_epp_driver = {
>  	.flags		= CPUFREQ_CONST_LOOPS,
> -	.verify		= amd_pstate_epp_verify_policy,
> +	.verify		= amd_pstate_verify,
>  	.setpolicy	= amd_pstate_epp_set_policy,
>  	.init		= amd_pstate_epp_cpu_init,
>  	.exit		= amd_pstate_epp_cpu_exit,
> -- 
> 2.34.1
>
Re: [PATCH v2 1/2] cpufreq/amd-pstate: Remove the redundant verify() function
Posted by Mario Limonciello 1 month, 1 week ago
On 10/16/2024 09:46, Dhananjay Ugwekar wrote:
> Merge the two verify() callback functions and rename the
> cpufreq_policy_data argument for better readability.
> 
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
>   drivers/cpufreq/amd-pstate.c | 15 ++++-----------
>   1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index b7a17a3ef122..fa16d72d6058 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -527,10 +527,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
>   	cpufreq_cpu_put(policy);
>   }
>   
> -static int amd_pstate_verify(struct cpufreq_policy_data *policy)
> +static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
>   {
> -	cpufreq_verify_within_cpu_limits(policy);
> -
> +	cpufreq_verify_within_cpu_limits(policy_data);
> +	pr_debug("policy_max =%d, policy_min=%d\n", policy_data->max, policy_data->min);
>   	return 0;
>   }
>   
> @@ -1661,13 +1661,6 @@ static int amd_pstate_epp_cpu_offline(struct cpufreq_policy *policy)
>   	return 0;
>   }
>   
> -static int amd_pstate_epp_verify_policy(struct cpufreq_policy_data *policy)
> -{
> -	cpufreq_verify_within_cpu_limits(policy);
> -	pr_debug("policy_max =%d, policy_min=%d\n", policy->max, policy->min);
> -	return 0;
> -}
> -
>   static int amd_pstate_epp_suspend(struct cpufreq_policy *policy)
>   {
>   	struct amd_cpudata *cpudata = policy->driver_data;
> @@ -1723,7 +1716,7 @@ static struct cpufreq_driver amd_pstate_driver = {
>   
>   static struct cpufreq_driver amd_pstate_epp_driver = {
>   	.flags		= CPUFREQ_CONST_LOOPS,
> -	.verify		= amd_pstate_epp_verify_policy,
> +	.verify		= amd_pstate_verify,
>   	.setpolicy	= amd_pstate_epp_set_policy,
>   	.init		= amd_pstate_epp_cpu_init,
>   	.exit		= amd_pstate_epp_cpu_exit,