Commit 2a813f1a authored by Prarit Bhargava's avatar Prarit Bhargava Committed by Rafael J. Wysocki

Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()"

This reverts commit 16b7c275.

My previous commit 16b7c275 ("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".

Fixes: 16b7c275 (tools: cpupower: fix return checks for ...)
Signed-off-by: default avatarPrarit Bhargava <prarit@redhat.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 16b7c275
...@@ -22,13 +22,13 @@ ...@@ -22,13 +22,13 @@
static void cpuidle_cpu_output(unsigned int cpu, int verbose) static void cpuidle_cpu_output(unsigned int cpu, int verbose)
{ {
int idlestates, idlestate; unsigned int idlestates, idlestate;
char *tmp; char *tmp;
printf(_ ("Analyzing CPU %d:\n"), cpu); printf(_ ("Analyzing CPU %d:\n"), cpu);
idlestates = sysfs_get_idlestate_count(cpu); idlestates = sysfs_get_idlestate_count(cpu);
if (idlestates < 1) { if (idlestates == 0) {
printf(_("CPU %u: No idle states\n"), cpu); printf(_("CPU %u: No idle states\n"), cpu);
return; return;
} }
...@@ -100,10 +100,10 @@ static void cpuidle_general_output(void) ...@@ -100,10 +100,10 @@ static void cpuidle_general_output(void)
static void proc_cpuidle_cpu_output(unsigned int cpu) static void proc_cpuidle_cpu_output(unsigned int cpu)
{ {
long max_allowed_cstate = 2000000000; long max_allowed_cstate = 2000000000;
int cstate, cstates; unsigned int cstate, cstates;
cstates = sysfs_get_idlestate_count(cpu); cstates = sysfs_get_idlestate_count(cpu);
if (cstates < 1) { if (cstates == 0) {
printf(_("CPU %u: No C-states info\n"), cpu); printf(_("CPU %u: No C-states info\n"), cpu);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment