From patchwork Fri Mar 3 11:26:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 9602557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 708A660453 for ; Fri, 3 Mar 2017 11:28:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61173285DC for ; Fri, 3 Mar 2017 11:28:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53EC1285ED; Fri, 3 Mar 2017 11:28:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0E0E285DC for ; Fri, 3 Mar 2017 11:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751369AbdCCL2U (ORCPT ); Fri, 3 Mar 2017 06:28:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54418 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbdCCL2T (ORCPT ); Fri, 3 Mar 2017 06:28:19 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 23EF980F63; Fri, 3 Mar 2017 11:26:56 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v23BQtQT018172; Fri, 3 Mar 2017 06:26:55 -0500 From: Prarit Bhargava To: linux-pm@vger.kernel.org Cc: Prarit Bhargava , Thomas Renninger , Stafford Horne , Shuah Khan Subject: [PATCH] cpupower: Fix no-rounding MHz frequency output Date: Fri, 3 Mar 2017 06:26:46 -0500 Message-Id: <1488540406-13738-1-git-send-email-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 03 Mar 2017 11:26:56 +0000 (UTC) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP '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 Cc: Thomas Renninger Cc: Stafford Horne Cc: Shuah Khan --- tools/power/cpupower/utils/cpufreq-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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));