Skip to content

Commit 0a405fe

Browse files
committed
Merge branches 'pm-cpufreq' and 'pm-cpuidle'
* pm-cpufreq: intel_pstate: Fail initialization if P-state information is missing cpufreq: preserve user_policy across suspend/resume cpufreq: Clean up after a failing light-weight initialization * pm-cpuidle: ARM/cpuidle: remove __init tag from Calxeda cpuidle probe function
3 parents 4706515 + 98a947a + 3308d53 commit 0a405fe

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)
839839

840840
/* set default policy */
841841
ret = cpufreq_set_policy(policy, &new_policy);
842-
policy->user_policy.policy = policy->policy;
843-
policy->user_policy.governor = policy->governor;
844-
845842
if (ret) {
846843
pr_debug("setting policy failed\n");
847844
if (cpufreq_driver->exit)
@@ -1016,15 +1013,17 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
10161013
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
10171014
#endif
10181015

1019-
if (frozen)
1020-
/* Restore the saved policy when doing light-weight init */
1021-
policy = cpufreq_policy_restore(cpu);
1022-
else
1016+
/*
1017+
* Restore the saved policy when doing light-weight init and fall back
1018+
* to the full init if that fails.
1019+
*/
1020+
policy = frozen ? cpufreq_policy_restore(cpu) : NULL;
1021+
if (!policy) {
1022+
frozen = false;
10231023
policy = cpufreq_policy_alloc();
1024-
1025-
if (!policy)
1026-
goto nomem_out;
1027-
1024+
if (!policy)
1025+
goto nomem_out;
1026+
}
10281027

10291028
/*
10301029
* In the resume path, since we restore a saved policy, the assignment
@@ -1069,8 +1068,10 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
10691068
*/
10701069
cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
10711070

1072-
policy->user_policy.min = policy->min;
1073-
policy->user_policy.max = policy->max;
1071+
if (!frozen) {
1072+
policy->user_policy.min = policy->min;
1073+
policy->user_policy.max = policy->max;
1074+
}
10741075

10751076
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
10761077
CPUFREQ_START, policy);
@@ -1101,6 +1102,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
11011102

11021103
cpufreq_init_policy(policy);
11031104

1105+
if (!frozen) {
1106+
policy->user_policy.policy = policy->policy;
1107+
policy->user_policy.governor = policy->governor;
1108+
}
1109+
11041110
kobject_uevent(&policy->kobj, KOBJ_ADD);
11051111
up_read(&cpufreq_rwsem);
11061112

@@ -1118,8 +1124,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
11181124
if (cpufreq_driver->exit)
11191125
cpufreq_driver->exit(policy);
11201126
err_set_policy_cpu:
1121-
if (frozen)
1127+
if (frozen) {
1128+
/* Do not leave stale fallback data behind. */
1129+
per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL;
11221130
cpufreq_policy_put_kobj(policy);
1131+
}
11231132
cpufreq_policy_free(policy);
11241133

11251134
nomem_out:

drivers/cpufreq/intel_pstate.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,11 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
614614
cpu = all_cpu_data[cpunum];
615615

616616
intel_pstate_get_cpu_pstates(cpu);
617+
if (!cpu->pstate.current_pstate) {
618+
all_cpu_data[cpunum] = NULL;
619+
kfree(cpu);
620+
return -ENODATA;
621+
}
617622

618623
cpu->cpu = cpunum;
619624

drivers/cpuidle/cpuidle-calxeda.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static struct cpuidle_driver calxeda_idle_driver = {
6565
.state_count = 2,
6666
};
6767

68-
static int __init calxeda_cpuidle_probe(struct platform_device *pdev)
68+
static int calxeda_cpuidle_probe(struct platform_device *pdev)
6969
{
7070
return cpuidle_register(&calxeda_idle_driver, NULL);
7171
}

0 commit comments

Comments
 (0)