patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] lib/power: fix governor storage to trim newlines
@ 2019-03-29 16:11 David Hunt
  2019-03-29 16:24 ` [dpdk-stable] [dpdk-dev] " Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: David Hunt @ 2019-03-29 16:11 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, anatoly.burakov, stable

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   | 4 ++++
 lib/librte_power/power_pstate_cpufreq.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
index 45412f0b9..c2febdf06 100644
--- a/lib/librte_power/power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -147,6 +147,10 @@ power_set_governor_userspace(struct rte_power_info *pi)
 
 	s = fgets(buf, sizeof(buf), f);
 	FOPS_OR_NULL_GOTO(s, out);
+	buf[BUFSIZ-1] = '\0';
+	if (strlen(buf))
+		/* 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..90a7eff35 100644
--- a/lib/librte_power/power_pstate_cpufreq.c
+++ b/lib/librte_power/power_pstate_cpufreq.c
@@ -292,6 +292,10 @@ power_set_governor_performance(struct pstate_power_info *pi)
 
 	s = fgets(buf, sizeof(buf), f);
 	FOPS_OR_NULL_GOTO(s, out);
+	buf[BUFSIZ-1] = '\0';
+	if (strlen(buf))
+		/* Strip off terminating '\n' */
+		strtok(buf, "\n");
 
 	/* Check if current governor is performance */
 	if (strncmp(buf, POWER_GOVERNOR_PERF,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-01 20:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 16:11 [dpdk-stable] [PATCH] lib/power: fix governor storage to trim newlines David Hunt
2019-03-29 16:24 ` [dpdk-stable] [dpdk-dev] " Bruce Richardson
2019-03-29 16:25 ` [dpdk-stable] " Burakov, Anatoly
2019-03-29 16:35   ` Hunt, David
2019-03-29 16:39 ` [dpdk-stable] [PATCH v2] " David Hunt
2019-03-29 17:56   ` Burakov, Anatoly
2019-04-01 20:24     ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

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).