From patchwork Tue Dec 1 16:14:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 7738641 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DF97BBEEE1 for ; Tue, 1 Dec 2015 16:14:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1669120524 for ; Tue, 1 Dec 2015 16:14:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43874204B5 for ; Tue, 1 Dec 2015 16:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754659AbbLAQOZ (ORCPT ); Tue, 1 Dec 2015 11:14:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:49855 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755585AbbLAQOV (ORCPT ); Tue, 1 Dec 2015 11:14:21 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 31503AC43; Tue, 1 Dec 2015 16:14:20 +0000 (UTC) From: Thomas Renninger To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, Jacob Tanenbaum , Thomas Renninger Subject: [PATCH 5/5] cpupower: fix how "cpupower frequency-info" interprets latency Date: Tue, 1 Dec 2015 17:14:17 +0100 Message-Id: <1448986457-12844-6-git-send-email-trenn@suse.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1448986457-12844-1-git-send-email-trenn@suse.com> References: <1448986457-12844-1-git-send-email-trenn@suse.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jacob Tanenbaum the intel-pstate driver does not support the ondemand governor and does not have a valid value in /sys/devices/system/cpu/cpu[x]/cpufreq/cpuinfo_transition_latency. The intel-pstate driver sets cpuinfo_transition_latency to CPUFREQ_ETERNAL (-1), the value written into cpuinfo_transition_latency is defind as an unsigned int so checking the read value against max unsigned int will determine if the value is valid. Signed-off-by: Jacob Tanenbaum Signed-off-by: Thomas Renninger --- tools/power/cpupower/utils/cpufreq-info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index c13bc8c..8f3f5bb 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c @@ -434,8 +434,8 @@ static int get_latency(unsigned int cpu, unsigned int human) unsigned long latency = cpufreq_get_transition_latency(cpu); printf(_(" maximum transition latency: ")); - if (!latency) { - printf(_(" Cannot determine latency.\n")); + if (!latency || latency == UINT_MAX) { + printf(_(" Cannot determine or is not supported.\n")); return -EINVAL; }