From: Prarit Bhargava <prarit@redhat.com>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>,
Thomas Renninger <trenn@suse.de>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: [PATCH 1/2] Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()"
Date: Sun, 14 Dec 2014 09:06:37 -0500 [thread overview]
Message-ID: <1418565998-3701-2-git-send-email-prarit@redhat.com> (raw)
In-Reply-To: <1418565998-3701-1-git-send-email-prarit@redhat.com>
This reverts commit 16b7c275c055cc36218404b5d147be7f76575087.
My previous commit 16b7c275c055 ("tools: cpupower: fix return checks for
sysfs_get_idlestate_count()") was not correct. After looking
at the changelog for cpupower I noticed that Thomas had changed the return of
sysfs_get_idlestate_count() to an unsigned int to simplify the code. The
problem is really that both he (in his original change) and I (in my new
change) missed the obvious that sysfs_get_idlestate_count()
can't return -ENODEV. It should just return 0 for "no c-states".
Cc: Thomas Renninger <trenn@suse.de>
Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
tools/power/cpupower/utils/cpuidle-info.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/power/cpupower/utils/cpuidle-info.c b/tools/power/cpupower/utils/cpuidle-info.c
index 458d69b..75e66de 100644
--- a/tools/power/cpupower/utils/cpuidle-info.c
+++ b/tools/power/cpupower/utils/cpuidle-info.c
@@ -22,13 +22,13 @@
static void cpuidle_cpu_output(unsigned int cpu, int verbose)
{
- int idlestates, idlestate;
+ unsigned int idlestates, idlestate;
char *tmp;
printf(_ ("Analyzing CPU %d:\n"), cpu);
idlestates = sysfs_get_idlestate_count(cpu);
- if (idlestates < 1) {
+ if (idlestates == 0) {
printf(_("CPU %u: No idle states\n"), cpu);
return;
}
@@ -100,10 +100,10 @@ static void cpuidle_general_output(void)
static void proc_cpuidle_cpu_output(unsigned int cpu)
{
long max_allowed_cstate = 2000000000;
- int cstate, cstates;
+ unsigned int cstate, cstates;
cstates = sysfs_get_idlestate_count(cpu);
- if (cstates < 1) {
+ if (cstates == 0) {
printf(_("CPU %u: No C-states info\n"), cpu);
return;
}
--
1.7.9.3
next prev parent reply other threads:[~2014-12-14 14:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-14 14:06 [PATCH 0/2] Properly fix sysfs_get_idlestate_count() Prarit Bhargava
2014-12-14 14:06 ` Prarit Bhargava [this message]
2014-12-14 14:06 ` [PATCH 2/2] Fix no idle state information return value Prarit Bhargava
2014-12-17 16:27 ` Thomas Renninger
2014-12-14 21:30 ` [PATCH 0/2] Properly fix sysfs_get_idlestate_count() Rafael J. Wysocki
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=1418565998-3701-2-git-send-email-prarit@redhat.com \
--to=prarit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=trenn@suse.de \
/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