Re: [PATCH 1/4] PM / EM: and devices to Energy Model

From: Quentin Perret
Date: Tue Jan 21 2020 - 04:32:07 EST


On Monday 20 Jan 2020 at 18:38:41 (+0000), Lukasz Luba wrote:
> I think we could avoid this additional argument 'cpumask'. I have
> checked the cpufreq_cpu_get function, which should do be good for this:
>
> ---------->8-------------------------
> static int _get_sharing_cpus(struct device *cpu_dev, struct cpumask *span)
> {
> struct cpufreq_policy *policy;
>
> policy = cpufreq_cpu_get(cpu_dev->id);
> if (policy) {
> cpumask_copy(span, policy->cpus);

That should be with 'policy->related_cpus', but yes if the policy
cpumasks have been populated this approach is OK I think.

> cpufreq_cpu_put(policy);
> return 0;
> } else {
> return -EINVAL;
> }
> }
> --------------------------8<-------------------------------

Thanks,
Quentin