Re: [PATCH v6 03/10] PM / EM: update callback structure and add device pointer

From: Daniel Lezcano
Date: Thu Apr 23 2020 - 09:22:59 EST


On Fri, Apr 10, 2020 at 09:42:03AM +0100, Lukasz Luba wrote:
> The Energy Model framework is going to support devices other that CPUs. In
> order to make this happen change the callback function and add pointer to
> a device as an argument.
>
> Update the related users to use new function and new callback from the
> Energy Model.
>
> Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>
> ---

[ ... ]

> +static struct em_perf_domain *
> +em_create_pd(struct device *dev, int nr_states, struct em_data_callback *cb,
> + cpumask_t *span)
> {
> unsigned long opp_eff, prev_opp_eff = ULONG_MAX;
> unsigned long power, freq, prev_freq = 0;
> @@ -106,7 +107,7 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states,
> * lowest performance state of 'cpu' above 'freq' and updates
> * 'power' and 'freq' accordingly.
> */
> - ret = cb->active_power(&power, &freq, cpu);
> + ret = cb->active_power(&power, &freq, dev);
> if (ret) {
> pr_err("pd%d: invalid perf. state: %d\n", cpu, ret);
> goto free_ps_table;

Why are the changes 'cpu' to 'dev' in the patch 4/10 instead of this one ?

> @@ -237,7 +238,7 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
> }
>
> /* Create the performance domain and add it to the Energy Model. */
> - pd = em_create_pd(span, nr_states, cb);
> + pd = em_create_pd(dev, nr_states, cb, span);
> if (!pd) {
> ret = -EINVAL;
> goto unlock;

--

<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog