[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190515110156.ru2wxqvwffqgq3t3@queper01-lin>
Date: Wed, 15 May 2019 12:01:58 +0100
From: Quentin Perret <quentin.perret@....com>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: Viresh Kumar <viresh.kumar@...aro.org>, edubezval@...il.com,
rui.zhang@...el.com, javi.merino@...nel.org,
amit.kachhap@...il.com, rjw@...ysocki.net, will.deacon@....com,
catalin.marinas@....com, dietmar.eggemann@....com,
ionela.voinescu@....com, mka@...omium.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v4 2/3] PM / EM: Expose perf domain struct
On Wednesday 15 May 2019 at 12:51:57 (+0200), Daniel Lezcano wrote:
> On 15/05/2019 12:46, Quentin Perret wrote:
> > On Wednesday 15 May 2019 at 11:40:44 (+0100), Quentin Perret wrote:
>
> [ ... ]
>
> >> +#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
> >> if (capacitance) {
> >> ret = update_freq_table(cpufreq_cdev, capacitance);
> >> if (ret) {
> >> cdev = ERR_PTR(ret);
> >> goto remove_ida;
> >> }
> >> -
> >> - cooling_ops = &cpufreq_power_cooling_ops;
> >> - } else {
> >> - cooling_ops = &cpufreq_cooling_ops;
> >> }
> >> +#endif
> >> + cooling_ops = &cpufreq_cooling_ops;
> >
> > Argh, that is actually broken with !capacitance and
> > THERMAL_GOV_POWER_ALLOCATOR=y ... Perhaps it's best to keep the two
> > thermal_cooling_device_ops struct separated in the end.
>
> Or alternatively you can keep one structure but instead of filling the
> state2power,power2state and getrequestedpower fields in the declaration,
> you fill them in the if (capacitance) block, no?
Something like the below ? Yes, that works too. I'll write a proper
patch and send that next week or so.
Thanks,
Quentin
--->8---
/* Bind cpufreq callbacks to thermal cooling device ops */
static struct thermal_cooling_device_ops cpufreq_cooling_ops = {
- .get_max_state = cpufreq_get_max_state,
- .get_cur_state = cpufreq_get_cur_state,
- .set_cur_state = cpufreq_set_cur_state,
-};
-
-static struct thermal_cooling_device_ops cpufreq_power_cooling_ops = {
.get_max_state = cpufreq_get_max_state,
.get_cur_state = cpufreq_get_cur_state,
.set_cur_state = cpufreq_set_cur_state,
- .get_requested_power = cpufreq_get_requested_power,
- .state2power = cpufreq_state2power,
- .power2state = cpufreq_power2state,
};
/* Notifier for cpufreq policy change */
@@ -674,18 +667,19 @@ __cpufreq_cooling_register(struct device_node *np,
pr_debug("%s: freq:%u KHz\n", __func__, freq);
}
+ cooling_ops = &cpufreq_cooling_ops;
+#ifdef CONFIG_THERMAL_GOV_POWER_ALLOCATOR
if (capacitance) {
ret = update_freq_table(cpufreq_cdev, capacitance);
if (ret) {
cdev = ERR_PTR(ret);
goto remove_ida;
}
-
- cooling_ops = &cpufreq_power_cooling_ops;
- } else {
- cooling_ops = &cpufreq_cooling_ops;
+ cooling_ops->get_requested_power = cpufreq_get_requested_power;
+ cooling_ops->state2power = cpufreq_state2power;
+ cooling_ops->power2state = cpufreq_power2state;
}
-
+#endif
cdev = thermal_of_cooling_device_register(np, dev_name, cpufreq_cdev,
cooling_ops);
if (IS_ERR(cdev))
Powered by blists - more mailing lists