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>
This commit is contained in:
David Hunt 2019-03-29 16:39:20 +00:00 committed by Thomas Monjalon
parent d6cefc11e0
commit 08a710642d
2 changed files with 4 additions and 0 deletions

View File

@ -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,

View File

@ -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,