linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: pi-cheng.chen@linaro.org (Pi-Cheng Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] thermal: cpu_cooling: Iterate over all CPUs in clip_cpu mask to get frequency table
Date: Wed,  1 Jul 2015 12:13:14 +0800	[thread overview]
Message-ID: <1435723994-3882-1-git-send-email-pi-cheng.chen@linaro.org> (raw)
In-Reply-To: <1435723647-3354-1-git-send-email-pi-cheng.chen@linaro.org>

Sorry for the mistake I made when cherry-picking the patch. Fix and resend
again.

__cpufreq_cooling_register() might fail if some CPU other than first one in
clip_cpu mask is present earlier e.g. CPU hotplug. Iterate all CPUs in the mask
to handle this case.

Signed-off-by: Pi-Cheng Chen <pi-cheng.chen@linaro.org>
---
 drivers/thermal/cpu_cooling.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c
index 6509c61..5e90eb6 100644
--- a/drivers/thermal/cpu_cooling.c
+++ b/drivers/thermal/cpu_cooling.c
@@ -776,9 +776,14 @@ __cpufreq_cooling_register(struct device_node *np,
 	char dev_name[THERMAL_NAME_LENGTH];
 	struct cpufreq_frequency_table *pos, *table;
 	unsigned int freq, i, num_cpus;
-	int ret;
+	int ret, cpu;
+
+	for_each_cpu(cpu, clip_cpus) {
+		table = cpufreq_frequency_get_table(cpu);
+		if (table)
+			break;
+	}
 
-	table = cpufreq_frequency_get_table(cpumask_first(clip_cpus));
 	if (!table) {
 		pr_debug("%s: CPUFreq table not found\n", __func__);
 		return ERR_PTR(-EPROBE_DEFER);
-- 
1.9.1

  reply	other threads:[~2015-07-01  4:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01  4:07 [PATCH] thermal: cpu_cooling: Iterate over all CPUs in clip_cpu mask to get frequency table Pi-Cheng Chen
2015-07-01  4:13 ` Pi-Cheng Chen [this message]
2015-07-07  7:52   ` Javi Merino
2015-07-07 10:27   ` Viresh Kumar
2015-07-08  1:50     ` Pi-Cheng Chen

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=1435723994-3882-1-git-send-email-pi-cheng.chen@linaro.org \
    --to=pi-cheng.chen@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).