Skip to content

Commit 81dbd6f

Browse files
committed
Merge tag 'pm-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "Three cpufreq fixes, one in the core (stable-candidate) and two in drivers (intel_pstate and cpufreq-dt). Specifics: - Fix a recent intel_pstate regression that caused the number of wakeups to increase significantly on an idle system in some cases due to excessive synchronize_sched() invocations (Rafael Wysocki). - Fix unnecessary invocations of WARN_ON() in the cpufreq core after cpufreq has been suspended introduced during the 4.6 cycla (Rafael Wysocki). - Fix an error code path in the cpufreq-dt-platdev driver that forgets to drop a reference to a DT node (Masahiro Yamada)" * tag 'pm-4.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq: Avoid false-positive WARN_ON()s in cpufreq_update_policy() cpufreq: dt: call of_node_put() before error out intel_pstate: Do not clear utilization update hooks on policy changes
2 parents 48c4565 + 742c87b commit 81dbd6f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

drivers/cpufreq/cpufreq-dt-platdev.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ static const struct of_device_id machines[] __initconst = {
7979
static int __init cpufreq_dt_platdev_init(void)
8080
{
8181
struct device_node *np = of_find_node_by_path("/");
82+
const struct of_device_id *match;
8283

8384
if (!np)
8485
return -ENODEV;
8586

86-
if (!of_match_node(machines, np))
87+
match = of_match_node(machines, np);
88+
of_node_put(np);
89+
if (!match)
8790
return -ENODEV;
8891

89-
of_node_put(of_root);
90-
9192
return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1,
9293
NULL, 0));
9394
}

drivers/cpufreq/cpufreq.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,10 @@ int cpufreq_update_policy(unsigned int cpu)
22612261
* -> ask driver for current freq and notify governors about a change
22622262
*/
22632263
if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
2264+
if (cpufreq_suspended) {
2265+
ret = -EAGAIN;
2266+
goto unlock;
2267+
}
22642268
new_policy.cur = cpufreq_update_current_freq(policy);
22652269
if (WARN_ON(!new_policy.cur)) {
22662270
ret = -EIO;

drivers/cpufreq/intel_pstate.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,6 +1400,9 @@ static void intel_pstate_set_update_util_hook(unsigned int cpu_num)
14001400
{
14011401
struct cpudata *cpu = all_cpu_data[cpu_num];
14021402

1403+
if (cpu->update_util_set)
1404+
return;
1405+
14031406
/* Prevent intel_pstate_update_util() from using stale data. */
14041407
cpu->sample.time = 0;
14051408
cpufreq_add_update_util_hook(cpu_num, &cpu->update_util,
@@ -1440,8 +1443,6 @@ static int intel_pstate_set_policy(struct cpufreq_policy *policy)
14401443
if (!policy->cpuinfo.max_freq)
14411444
return -ENODEV;
14421445

1443-
intel_pstate_clear_update_util_hook(policy->cpu);
1444-
14451446
pr_debug("set_policy cpuinfo.max %u policy->max %u\n",
14461447
policy->cpuinfo.max_freq, policy->max);
14471448

0 commit comments

Comments
 (0)