From patchwork Mon Oct 23 11:56:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 10022375 X-Patchwork-Delegate: shuah@kernel.org 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 F325360245 for ; Mon, 23 Oct 2017 11:56:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3DFF2886D for ; Mon, 23 Oct 2017 11:56:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E88DE28870; Mon, 23 Oct 2017 11:56:36 +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 728292886D for ; Mon, 23 Oct 2017 11:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932141AbdJWL4f (ORCPT ); Mon, 23 Oct 2017 07:56:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55002 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932096AbdJWL4f (ORCPT ); Mon, 23 Oct 2017 07:56:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8826C0587C0; Mon, 23 Oct 2017 11:56:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E8826C0587C0 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=prarit@redhat.com Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 594575DA60; Mon, 23 Oct 2017 11:56:34 +0000 (UTC) From: Prarit Bhargava To: linux-pm@vger.kernel.org Cc: Prarit Bhargava , Thomas Renninger , Stafford Horne , Shuah Khan Subject: [PATCH RESEND] cpupower: Fix no-rounding MHz frequency output Date: Mon, 23 Oct 2017 07:56:32 -0400 Message-Id: <20171023115632.27998-1-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 23 Oct 2017 11:56:35 +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 Sent about a year ago ... P. ---8<--- '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));