intel-pstate: Fix inhibition not being detected

We should have inhibited the performance profile when "no_turbo" was set
to "1", but we didn't take the linefeed into account, so we never
actually read that value.
This commit is contained in:
Bastien Nocera 2021-03-16 16:17:42 +01:00
parent 0e02519880
commit b3ab935ac8
2 changed files with 3 additions and 2 deletions

View file

@ -80,6 +80,7 @@ update_no_turbo (PpdDriverIntelPstate *pstate)
gboolean turbo_disabled = FALSE;
if (g_file_get_contents (pstate->no_turbo_path, &contents, NULL, NULL)) {
contents = g_strchomp (contents);
if (g_strcmp0 (contents, "1") == 0)
turbo_disabled = TRUE;
}

View file

@ -317,7 +317,7 @@ class Tests(dbusmock.DBusTestCase):
pstate_dir = os.path.join(self.testbed.get_root_dir(), "sys/devices/system/cpu/intel_pstate")
os.makedirs(pstate_dir)
with open(os.path.join(pstate_dir, "no_turbo") ,'w') as no_turbo:
no_turbo.write("0")
no_turbo.write("0\n")
self.start_daemon()
@ -342,7 +342,7 @@ class Tests(dbusmock.DBusTestCase):
# Disable turbo
with open(os.path.join(pstate_dir, "no_turbo") ,'w') as no_turbo:
no_turbo.write("1")
no_turbo.write("1\n")
self.assertEventually(lambda: self.have_text_in_log('File monitor change happened for '))
self.assertEqual(self.get_dbus_property('ActiveProfile'), 'balanced')