Re: [PATCH v3 2/2] cpufreq: ap806: add cpufreq driver for Armada 8K
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: 2018-12-19 04:41:02
Also in:
linux-pm
On 18-12-18, 15:32, Gregory CLEMENT wrote:
On lun., déc. 17 2018, Viresh Kumar [off-list ref] wrote:quoted
On 11-12-18, 17:42, Gregory CLEMENT wrote:quoted
+++ b/drivers/cpufreq/armada-8k-cpufreq.c
quoted
quoted
+ for (i = 0; i < nb_cpus; i++) { + if (clk_is_match(clk, freq_tables[i].clk)) { + skip = 1;Why not do devm_clk_put() from right here and "continue" after that. That way you can avoid "skip" variable as well.We need to keep a reference to the clk when it used later in the loop.
Maybe I wasn't able to clarify what I was suggesting. This code can be written
as:
for (i = 0; i < nb_cpus; i++) {
if (clk_is_match(clk, freq_tables[i].clk)) {
devm_clk_put(cpu_dev, clk);
continue;
}
}
I don't see how the current code is different than this.
I think you missed the fact that no variable are passed to the exit function but we still need to have a reference on the OPP to free, so we cant do without this global variable. However I could reduce the amount by hiding them in a platform data associated to the platform_device.
Maybe, lets see how the simplified form of the driver looks like. And then see if something is still left to be done. -- viresh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel