Skip to content

Commit

Permalink
Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_co…
Browse files Browse the repository at this point in the history
…unt()"

This reverts commit 16b7c27.

My previous commit 16b7c27 ("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: 16b7c27 (tools: cpupower: fix return checks for ...)
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Prarit Bhargava authored and Rafael J. Wysocki committed Dec 14, 2014
1 parent 16b7c27 commit 2a813f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/power/cpupower/utils/cpuidle-info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2a813f1

Please sign in to comment.