Patchwork cpuidle: governor: Add new governors to cpuidle_governors again

login
register
mail settings
Submitter Rafael J. Wysocki
Date March 12, 2019, 6:13 p.m.
Message ID <5539737.TtKXfUnNfs@aspire.rjw.lan>
Download mbox | patch
Permalink /patch/747571/
State New
Headers show

Comments

Rafael J. Wysocki - March 12, 2019, 6:13 p.m.
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

After commit 61cb5758d3c4 ("cpuidle: Add cpuidle.governor= command
line parameter") new cpuidle governors are not added to the list
of available governors, so governor selection via sysfs doesn't
work as expected (even though it is rarely used anyway).

Fix that by making cpuidle_register_governor() add new governors to
cpuidle_governors again.

Fixes: 61cb5758d3c4 ("cpuidle: Add cpuidle.governor= command line parameter")
Reported-by: Kees Cook <keescook@chromium.org>
Cc: 5.0+ <stable@vger.kernel.org> # 5.0+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpuidle/governor.c |    1 +
 1 file changed, 1 insertion(+)

Patch

Index: linux-pm/drivers/cpuidle/governor.c
===================================================================
--- linux-pm.orig/drivers/cpuidle/governor.c
+++ linux-pm/drivers/cpuidle/governor.c
@@ -89,6 +89,7 @@  int cpuidle_register_governor(struct cpu
 	mutex_lock(&cpuidle_lock);
 	if (__cpuidle_find_governor(gov->name) == NULL) {
 		ret = 0;
+		list_add_tail(&gov->governor_list, &cpuidle_governors);
 		if (!cpuidle_curr_governor ||
 		    !strncasecmp(param_governor, gov->name, CPUIDLE_NAME_LEN) ||
 		    (cpuidle_curr_governor->rating < gov->rating &&