DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Hunt <david.hunt@intel.com>
To: dev@dpdk.org
Cc: david.hunt@intel.com, anatoly.burakov@intel.com, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2] lib/power: fix governor storage to trim newlines
Date: Fri, 29 Mar 2019 16:39:20 +0000	[thread overview]
Message-ID: <20190329163920.40415-1-david.hunt@intel.com> (raw)
Message-ID: <20190329163920.wP0N9PnLO0ng1VQBKy0nuNeUEtQzo7eDcprur6FhGkU@z> (raw)
In-Reply-To: <20190329161142.39787-1-david.hunt@intel.com>

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 <david.hunt@intel.com>
---
 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


  parent reply	other threads:[~2019-03-29 16:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29 16:11 [dpdk-dev] [PATCH] " David Hunt
2019-03-29 16:11 ` David Hunt
2019-03-29 16:24 ` Bruce Richardson
2019-03-29 16:24   ` Bruce Richardson
2019-03-29 16:25 ` Burakov, Anatoly
2019-03-29 16:25   ` Burakov, Anatoly
2019-03-29 16:35   ` Hunt, David
2019-03-29 16:35     ` Hunt, David
2019-03-29 16:39 ` David Hunt [this message]
2019-03-29 16:39   ` [dpdk-dev] [PATCH v2] " David Hunt
2019-03-29 17:56   ` Burakov, Anatoly
2019-03-29 17:56     ` Burakov, Anatoly
2019-04-01 20:24     ` Thomas Monjalon
2019-04-01 20:24       ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190329163920.40415-1-david.hunt@intel.com \
    --to=david.hunt@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).