History

cpufreq: Fix policy initialization for internal governor drivers

Before commit 1e4f63aecb53 ("cpufreq: Avoid creating excessively large stack frames") the initial value of the policy field in struct cpufreq_policy set by the driver's ->init() callback was implicitly passed from cpufreq_init_policy() to cpufreq_set_policy() if the default governor was neither "performance" nor "powersave". After that commit, however, cpufreq_init_policy() must take that case into consideration explicitly and handle it as appropriate, so make that happen.

Rafael J. Wysocki committed 6 years ago

Commit f5739cb1 parent f8788d81 file · +10 −2Browse files

Unified · Split

drivers/cpufreq/cpufreq.c+10−2
@@ -1076,9 +1076,17 @@ static int cpufreq_init_policy(struct cpufreq_policy *policy) · 1075 unmodified lines
1076 pol = policy->last_policy;1076 pol = policy->last_policy;
1077 } else if (def_gov) {1077 } else if (def_gov) {
1078 pol = cpufreq_parse_policy(def_gov->name);1078 pol = cpufreq_parse_policy(def_gov->name);
1079 } else {1079 /*
1080 return -ENODATA;1080 * In case the default governor is neiter "performance"
1081 * nor "powersave", fall back to the initial policy
1082 * value set by the driver.
1083 */
1084 if (pol == CPUFREQ_POLICY_UNKNOWN)
1085 pol = policy->policy;
1081 }1086 }
1087 if (pol != CPUFREQ_POLICY_PERFORMANCE &&
1088 pol != CPUFREQ_POLICY_POWERSAVE)
1089 return -ENODATA;
1082 }1090 }
1083 1091
1084 return cpufreq_set_policy(policy, gov, pol);1092 return cpufreq_set_policy(policy, gov, pol);