summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hunt <david.hunt@intel.com>2019-03-29 16:39:20 +0000
committerThomas Monjalon <thomas@monjalon.net>2019-04-01 22:23:44 +0200
commit08a710642d1d8bed831ecf2085e041213381fc68 (patch)
tree869ca87c022ddb288b31ff74335d53ad2c5ae65a
parentd6cefc11e05f0ddd87eef79f47d45fd3d01bb4bc (diff)
downloaddpdk-next-eventdev-08a710642d1d8bed831ecf2085e041213381fc68.zip
dpdk-next-eventdev-08a710642d1d8bed831ecf2085e041213381fc68.tar.gz
dpdk-next-eventdev-08a710642d1d8bed831ecf2085e041213381fc68.tar.xz
power: fix governor storage to trim newlines
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> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
-rw-r--r--lib/librte_power/power_acpi_cpufreq.c2
-rw-r--r--lib/librte_power/power_pstate_cpufreq.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/librte_power/power_acpi_cpufreq.c b/lib/librte_power/power_acpi_cpufreq.c
index 534efe8..49325d0 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 9c1a162..3e04e80 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,