Skip to content

Commit bf3a85b

Browse files
committed
cpupower: Add support for parsing 'enabled' or 'disabled' strings from table
JIRA: https://issues.redhat.com/browse/RHEL-80660 commit 3f2eb76 Author: Mario Limonciello <[email protected]> Date: Wed Dec 18 13:09:51 2024 -0600 cpupower: Add support for parsing 'enabled' or 'disabled' strings from table When cpufreq_get_sysfs_value_from_table() is passed a table with kernel strings that report 'enabled' or 'disabled' it always returns 0 because these can't cleanly convert to integers. Explicitly look for enabled or disabled strings from the kernel to handle this. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Shuah Khan <[email protected]> Signed-off-by: David Arcari <[email protected]>
1 parent da6e2ca commit bf3a85b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/power/cpupower/lib/cpufreq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ unsigned long cpufreq_get_sysfs_value_from_table(unsigned int cpu,
102102
if (len == 0)
103103
return 0;
104104

105+
if (!strcmp(linebuf, "enabled\n"))
106+
return 1;
107+
if (!strcmp(linebuf, "disabled\n"))
108+
return 0;
105109
value = strtoul(linebuf, &endp, 0);
106110

107111
if (endp == linebuf || errno == ERANGE)

0 commit comments

Comments
 (0)