From bbfee650f719184201115e6c8c51e12c8c5d49b8 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Sun, 14 Dec 2014 09:06:37 -0500 Subject: [PATCH] Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()" This reverts commit a9cfd44a2730769d9e7c946039752ddae2a39ce8. My previous commit a9cfd44a2730 ("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: a9cfd44a2730 (tools: cpupower: fix return checks for ...) Signed-off-by: Prarit Bhargava Signed-off-by: Rafael J. Wysocki --- 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 458d69b444ad7..75e66de7e7a7f 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; } -- 2.39.5