linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Noonan <steven@uplinklabs.net>
To: linux-pm@vger.kernel.org
Cc: Thomas Renninger <trenn@suse.com>, Steven Noonan <steven@uplinklabs.net>
Subject: [PATCH] cpupower: fix frequency-set check for online CPUs
Date: Sun,  4 Sep 2016 15:44:04 -0700	[thread overview]
Message-ID: <20160904224404.29863-1-steven@uplinklabs.net> (raw)

It used to look at whether the cpuN directory existed (a function which
returned 0 on success, nonzero on failure), but the cpupower_is_cpu_online
function returns 1 when the CPU is online. This caused it to skip all online
CPUs since it was expecting 0 to mean 'online'.

We also had a redundant (and also wrong) check on cpupower_is_cpu_online when
iterating over the bitmask to run the set operations.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
---
 tools/power/cpupower/utils/cpufreq-set.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
index b4bf769..ec7d7da 100644
--- a/tools/power/cpupower/utils/cpufreq-set.c
+++ b/tools/power/cpupower/utils/cpufreq-set.c
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
 			struct cpufreq_affected_cpus *cpus;
 
 			if (!bitmask_isbitset(cpus_chosen, cpu) ||
-			    cpupower_is_cpu_online(cpu))
+			    cpupower_is_cpu_online(cpu) != 1)
 				continue;
 
 			cpus = cpufreq_get_related_cpus(cpu);
@@ -315,8 +315,7 @@ int cmd_freq_set(int argc, char **argv)
 	for (cpu = bitmask_first(cpus_chosen);
 	     cpu <= bitmask_last(cpus_chosen); cpu++) {
 
-		if (!bitmask_isbitset(cpus_chosen, cpu) ||
-		    cpupower_is_cpu_online(cpu))
+		if (!bitmask_isbitset(cpus_chosen, cpu))
 			continue;
 
 		if (cpupower_is_cpu_online(cpu) != 1)
-- 
2.9.3


                 reply	other threads:[~2016-09-04 22:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160904224404.29863-1-steven@uplinklabs.net \
    --to=steven@uplinklabs.net \
    --cc=linux-pm@vger.kernel.org \
    --cc=trenn@suse.com \
    /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).