From: Javi Merino <javi.merino@arm.com>
To: Lukasz Luba <lukasz.luba@arm.com>
Cc: linux-pm@vger.kernel.org, amit.kachhap@gmail.com,
viresh.kumar@linaro.org, rui.zhang@intel.com,
edubezval@gmail.com
Subject: Re: [PATCH] thermal: cpu_cooling: fix improper order during initialization
Date: Wed, 1 Jun 2016 09:36:55 +0100 [thread overview]
Message-ID: <20160601083655.GC2898@e104805> (raw)
In-Reply-To: <1464690722-27996-1-git-send-email-lukasz.luba@arm.com>
On Tue, May 31, 2016 at 11:32:02AM +0100, Lukasz Luba wrote:
> The freq_table array is not populated before calling
> thermal_of_cooling_register. The code which populates the freq table was
> introduced in commit f6859014.
> This should be done before registering new thermal cooling device.
> The log shows effects of this wrong decision.
> [ 2.172614] cpu cpu1: Failed to get voltage for frequency 1984518656000: -34
> [ 2.220863] cpu cpu0: Failed to get voltage for frequency 1984524416000: -34
>
> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Yes, the cooling device should only be registered after all its fields
have been populated.
Acked-by: Javi Merino <javi.merino@arm.com>
> ---
> drivers/thermal/cpu_cooling.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
> index 6ceac4f..5b4b47e 100644
> --- a/drivers/thermal/cpu_cooling.c
> +++ b/drivers/thermal/cpu_cooling.c
> @@ -857,14 +857,6 @@ __cpufreq_cooling_register(struct device_node *np,
> goto free_power_table;
> }
>
> - snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
> - cpufreq_dev->id);
> -
> - cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
> - &cpufreq_cooling_ops);
> - if (IS_ERR(cool_dev))
> - goto remove_idr;
> -
> /* Fill freq-table in descending order of frequencies */
> for (i = 0, freq = -1; i <= cpufreq_dev->max_level; i++) {
> freq = find_next_max(table, freq);
> @@ -877,6 +869,14 @@ __cpufreq_cooling_register(struct device_node *np,
> pr_debug("%s: freq:%u KHz\n", __func__, freq);
> }
>
> + snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
> + cpufreq_dev->id);
> +
> + cool_dev = thermal_of_cooling_device_register(np, dev_name, cpufreq_dev,
> + &cpufreq_cooling_ops);
> + if (IS_ERR(cool_dev))
> + goto remove_idr;
> +
> cpufreq_dev->clipped_freq = cpufreq_dev->freq_table[0];
> cpufreq_dev->cool_dev = cool_dev;
>
> --
> 1.9.1
>
next prev parent reply other threads:[~2016-06-01 8:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 10:32 [PATCH] thermal: cpu_cooling: fix improper order during initialization Lukasz Luba
2016-06-01 8:36 ` Javi Merino [this message]
2016-06-01 11:10 ` Viresh Kumar
2016-06-01 13:31 ` Lukasz Luba
2016-06-01 13:39 ` Viresh Kumar
2016-06-01 14:27 ` Zhang, Rui
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160601083655.GC2898@e104805 \
--to=javi.merino@arm.com \
--cc=amit.kachhap@gmail.com \
--cc=edubezval@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rui.zhang@intel.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox