diff mbox series

[5/8] cppc_cpufreq: use policy->cpu as driver of frequency setting

Message ID 20201105125524.4409-6-ionela.voinescu@arm.com
State Superseded
Headers show
Series [1/8] cppc_cpufreq: fix misspelling, code style and readability issues | expand

Commit Message

Ionela Voinescu Nov. 5, 2020, 12:55 p.m. UTC
Considering only the currently supported coordination types (ANY, HW,
NONE), this change only makes a difference for the ANY type, when
policy->cpu is hotplugged out. In that case the new policy->cpu will
be different from ((struct cppc_cpudata *)policy->driver_data)->cpu.

While in this case the controls of *ANY* CPU could be used to drive
frequency changes, it's more consistent to use policy->cpu as the
leading CPU, as used in all other cppc_cpufreq functions. Additionally,
the debug prints in cppc_set_perf() would no longer create confusion
when referring to a CPU that is hotplugged out.

Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/cppc_cpufreq.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Viresh Kumar Nov. 9, 2020, 7:05 a.m. UTC | #1
On 05-11-20, 12:55, Ionela Voinescu wrote:
> Considering only the currently supported coordination types (ANY, HW,

> NONE), this change only makes a difference for the ANY type, when

> policy->cpu is hotplugged out. In that case the new policy->cpu will

> be different from ((struct cppc_cpudata *)policy->driver_data)->cpu.

> 

> While in this case the controls of *ANY* CPU could be used to drive

> frequency changes, it's more consistent to use policy->cpu as the

> leading CPU, as used in all other cppc_cpufreq functions. Additionally,

> the debug prints in cppc_set_perf() would no longer create confusion

> when referring to a CPU that is hotplugged out.

> 

> Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>

> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>

> Cc: Viresh Kumar <viresh.kumar@linaro.org>

> ---

>  drivers/cpufreq/cppc_cpufreq.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c

> index ac95b4424a2e..fd2daeb59b49 100644

> --- a/drivers/cpufreq/cppc_cpufreq.c

> +++ b/drivers/cpufreq/cppc_cpufreq.c

> @@ -150,6 +150,7 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,

>  

>  {

>  	struct cppc_cpudata *cpu_data = policy->driver_data;

> +	unsigned int cpu = policy->cpu;

>  	struct cpufreq_freqs freqs;

>  	u32 desired_perf;

>  	int ret = 0;

> @@ -164,12 +165,12 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,

>  	freqs.new = target_freq;

>  

>  	cpufreq_freq_transition_begin(policy, &freqs);

> -	ret = cppc_set_perf(cpu_data->cpu, &cpu_data->perf_ctrls);

> +	ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls);

>  	cpufreq_freq_transition_end(policy, &freqs, ret != 0);

>  

>  	if (ret)

>  		pr_debug("Failed to set target on CPU:%d. ret:%d\n",

> -			 cpu_data->cpu, ret);

> +			 cpu, ret);

>  

>  	return ret;

>  }


Acked-by: Viresh Kumar <viresh.kumar@linaro.org>


-- 
viresh
diff mbox series

Patch

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index ac95b4424a2e..fd2daeb59b49 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -150,6 +150,7 @@  static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,
 
 {
 	struct cppc_cpudata *cpu_data = policy->driver_data;
+	unsigned int cpu = policy->cpu;
 	struct cpufreq_freqs freqs;
 	u32 desired_perf;
 	int ret = 0;
@@ -164,12 +165,12 @@  static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,
 	freqs.new = target_freq;
 
 	cpufreq_freq_transition_begin(policy, &freqs);
-	ret = cppc_set_perf(cpu_data->cpu, &cpu_data->perf_ctrls);
+	ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls);
 	cpufreq_freq_transition_end(policy, &freqs, ret != 0);
 
 	if (ret)
 		pr_debug("Failed to set target on CPU:%d. ret:%d\n",
-			 cpu_data->cpu, ret);
+			 cpu, ret);
 
 	return ret;
 }