Skip to content

Commit 2a813f1

Browse files
praritrafaeljw
authored andcommitted
Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()"
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>
1 parent 16b7c27 commit 2a813f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/power/cpupower/utils/cpuidle-info.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222

2323
static void cpuidle_cpu_output(unsigned int cpu, int verbose)
2424
{
25-
int idlestates, idlestate;
25+
unsigned int idlestates, idlestate;
2626
char *tmp;
2727

2828
printf(_ ("Analyzing CPU %d:\n"), cpu);
2929

3030
idlestates = sysfs_get_idlestate_count(cpu);
31-
if (idlestates < 1) {
31+
if (idlestates == 0) {
3232
printf(_("CPU %u: No idle states\n"), cpu);
3333
return;
3434
}
@@ -100,10 +100,10 @@ static void cpuidle_general_output(void)
100100
static void proc_cpuidle_cpu_output(unsigned int cpu)
101101
{
102102
long max_allowed_cstate = 2000000000;
103-
int cstate, cstates;
103+
unsigned int cstate, cstates;
104104

105105
cstates = sysfs_get_idlestate_count(cpu);
106-
if (cstates < 1) {
106+
if (cstates == 0) {
107107
printf(_("CPU %u: No C-states info\n"), cpu);
108108
return;
109109
}

0 commit comments

Comments
 (0)