Re: [PATCH v2 3/3] cpufreq: CPPC: Register EM based on efficiency class information

From: Viresh Kumar
Date: Sun Apr 10 2022 - 23:12:45 EST


On 07-04-22, 10:16, Pierre Gondois wrote:
> +static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
> +{
> + struct cppc_cpudata *cpu_data;
> + struct em_data_callback em_cb =
> + EM_ADV_DATA_CB(cppc_get_cpu_power, cppc_get_cpu_cost);
> +
> + if (!efficiency_class_populated)

Instead of a new variable for this, what about setting
cppc_cpufreq_driver.register_em = cppc_cpufreq_register_em, only if
you were able to populate the efficiency class in the first place ?

> + return;
> +
> + cpu_data = cppc_cpufreq_search_cpu_data(policy->cpu);
> + em_dev_register_perf_domain(get_cpu_device(policy->cpu),
> + get_perf_level_count(policy), &em_cb,
> + cpu_data->shared_cpu_map, 0);
> +}
> +
> #else
>
> static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
> @@ -471,6 +609,9 @@ static int populate_efficiency_class(void)
> {
> return 0;
> }
> +static void cppc_cpufreq_register_em(struct cpufreq_policy *policy)
> +{
> +}
> #endif
>
>
> @@ -742,6 +883,7 @@ static struct cpufreq_driver cppc_cpufreq_driver = {
> .init = cppc_cpufreq_cpu_init,
> .exit = cppc_cpufreq_cpu_exit,
> .set_boost = cppc_cpufreq_set_boost,
> + .register_em = cppc_cpufreq_register_em,
> .attr = cppc_cpufreq_attr,
> .name = "cppc_cpufreq",
> };
> --
> 2.25.1

--
viresh