From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E2D25A05D3 for ; Fri, 29 Mar 2019 17:39:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0443D4C93; Fri, 29 Mar 2019 17:39:32 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id D0FFE2965; Fri, 29 Mar 2019 17:39:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 09:39:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,285,1549958400"; d="scan'208";a="287052957" Received: from silpixa00399952.ir.intel.com (HELO silpixa00399952.ger.corp.intel.com) ([10.237.223.64]) by orsmga004.jf.intel.com with ESMTP; 29 Mar 2019 09:39:27 -0700 From: David Hunt To: dev@dpdk.org Cc: david.hunt@intel.com, anatoly.burakov@intel.com, stable@dpdk.org Date: Fri, 29 Mar 2019 16:39:20 +0000 Message-Id: <20190329163920.40415-1-david.hunt@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190329161142.39787-1-david.hunt@intel.com> References: <20190329161142.39787-1-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v2] lib/power: fix governor storage to trim newlines X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190329163920.wP0N9PnLO0ng1VQBKy0nuNeUEtQzo7eDcprur6FhGkU@z> Currently the Power Libray stores the governor name with an embedded newline read from the scaling_governor sysfs file. This patch strips it out. Fixes: 445c6528b55f ("power: common interface for guest and host") Cc: stable@dpdk.org Signed-off-by: David Hunt --- lib/librte_power/power_acpi_cpufreq.c | 2 ++ lib/librte_power/power_pstate_cpufreq.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c index 45412f0b9..cdcb1f613 100644 --- a/lib/librte_power/power_acpi_cpufreq.c +++ b/lib/librte_power/power_acpi_cpufreq.c @@ -147,6 +147,8 @@ power_set_governor_userspace(struct rte_power_info *pi) s = fgets(buf, sizeof(buf), f); FOPS_OR_NULL_GOTO(s, out); + /* Strip off terminating '\n' */ + strtok(buf, "\n"); /* Check if current governor is userspace */ if (strncmp(buf, POWER_GOVERNOR_USERSPACE, diff --git a/lib/librte_power/power_pstate_cpufreq.c b/lib/librte_power/power_pstate_cpufreq.c index 9c1a1625f..3e04e8040 100644 --- a/lib/librte_power/power_pstate_cpufreq.c +++ b/lib/librte_power/power_pstate_cpufreq.c @@ -292,6 +292,8 @@ power_set_governor_performance(struct pstate_power_info *pi) s = fgets(buf, sizeof(buf), f); FOPS_OR_NULL_GOTO(s, out); + /* Strip off terminating '\n' */ + strtok(buf, "\n"); /* Check if current governor is performance */ if (strncmp(buf, POWER_GOVERNOR_PERF, -- 2.17.1