Re: [PATCH 2/7] cpufreq: dt: Register an Energy Model

From: Quentin Perret
Date: Wed Jan 30 2019 - 05:20:51 EST


On Wednesday 30 Jan 2019 at 15:47:15 (+0530), Viresh Kumar wrote:
> On 30-01-19, 09:12, Quentin Perret wrote:
> > What I had in mind is something as simple as:
> >
> > void of_dev_pm_opp_register_em(struct cpumask *cpus)
> > {
> > /* Bail out if an EM is there */
> > if (em_cpu_get(cpumask_first(cpus)))
> > return;
> >
> > /* Check prerequisites: dpc coeff in DT, ... */
> > ...
> >
> > em_register_perf_domain(...);
> > }
> >
> > IIUC, Matthias' point was that if the EM is already registered, there is
> > no good reason to call em_register_perf_domain() again. Now, that should
> > in fact be harmless because em_register_perf_domain() already does that
> > check. It's just cleaner and easier to understand from a conceptual
> > standpoint to not call that function several times for no reason I
> > assume.
>
> If there is no good reason to call em_register_perf_domain() several
> times, then the same applies to of_dev_pm_opp_register_em() as well,
> isn't it ?

Hrmpf, that is true ... :-)

> This is init code anyway isn't going to run a lot, so I wouldn't
> suggest adding any such (duplicate) checks in
> of_dev_pm_opp_register_em().

Fair enough, I'll post a v2 w/o the check and we'll see if others have
complaints.

Thanks,
Quentin