diff mbox

cpupower: Fix no-rounding MHz frequency output

Message ID 1488540406-13738-1-git-send-email-prarit@redhat.com (mailing list archive)
State Deferred
Headers show

Commit Message

Prarit Bhargava March 3, 2017, 11:26 a.m. UTC
'cpupower frequency-info -ln' returns kHz values on systems with MHz range
minimum CPU frequency range.  For example, on a 800MHz to 4.20GHz system
the command returns

hardware limits: 800000 MHz - 4.200000 GHz

The value of speed passed into print_speed is in kHz, so divide speed by
1000 in the MHz else-if section to get MHz.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Renninger <trenn@suse.com>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
---
 tools/power/cpupower/utils/cpufreq-info.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c
index 3e701f0e9c14..fe7c25147b3a 100644
--- a/tools/power/cpupower/utils/cpufreq-info.c
+++ b/tools/power/cpupower/utils/cpufreq-info.c
@@ -94,7 +94,7 @@  static void print_speed(unsigned long speed)
 			printf("%u.%06u GHz", ((unsigned int) speed/1000000),
 				((unsigned int) speed%1000000));
 		else if (speed > 100000)
-			printf("%u MHz", (unsigned int) speed);
+			printf("%u MHz", (unsigned int) speed/1000);
 		else if (speed > 1000)
 			printf("%u.%03u MHz", ((unsigned int) speed/1000),
 				(unsigned int) (speed%1000));