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
This commit is contained in:
Rafael J. Wysocki 2013-12-31 22:09:28 +01:00
commit 0a405fe97f
3 changed files with 29 additions and 15 deletions

View File

@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)
/* set default policy */ /* set default policy */
ret = cpufreq_set_policy(policy, &new_policy); ret = cpufreq_set_policy(policy, &new_policy);
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;
if (ret) { if (ret) {
pr_debug("setting policy failed\n"); pr_debug("setting policy failed\n");
if (cpufreq_driver->exit) if (cpufreq_driver->exit)
@ -1016,15 +1013,17 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
read_unlock_irqrestore(&cpufreq_driver_lock, flags); read_unlock_irqrestore(&cpufreq_driver_lock, flags);
#endif #endif
if (frozen) /*
/* Restore the saved policy when doing light-weight init */ * Restore the saved policy when doing light-weight init and fall back
policy = cpufreq_policy_restore(cpu); * to the full init if that fails.
else */
policy = frozen ? cpufreq_policy_restore(cpu) : NULL;
if (!policy) {
frozen = false;
policy = cpufreq_policy_alloc(); policy = cpufreq_policy_alloc();
if (!policy)
if (!policy) goto nomem_out;
goto nomem_out; }
/* /*
* In the resume path, since we restore a saved policy, the assignment * 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,
*/ */
cpumask_and(policy->cpus, policy->cpus, cpu_online_mask); cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
policy->user_policy.min = policy->min; if (!frozen) {
policy->user_policy.max = policy->max; policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;
}
blocking_notifier_call_chain(&cpufreq_policy_notifier_list, blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy); CPUFREQ_START, policy);
@ -1101,6 +1102,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
cpufreq_init_policy(policy); cpufreq_init_policy(policy);
if (!frozen) {
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;
}
kobject_uevent(&policy->kobj, KOBJ_ADD); kobject_uevent(&policy->kobj, KOBJ_ADD);
up_read(&cpufreq_rwsem); up_read(&cpufreq_rwsem);
@ -1118,8 +1124,11 @@ err_get_freq:
if (cpufreq_driver->exit) if (cpufreq_driver->exit)
cpufreq_driver->exit(policy); cpufreq_driver->exit(policy);
err_set_policy_cpu: err_set_policy_cpu:
if (frozen) if (frozen) {
/* Do not leave stale fallback data behind. */
per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL;
cpufreq_policy_put_kobj(policy); cpufreq_policy_put_kobj(policy);
}
cpufreq_policy_free(policy); cpufreq_policy_free(policy);
nomem_out: nomem_out:

View File

@ -614,6 +614,11 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu = all_cpu_data[cpunum]; cpu = all_cpu_data[cpunum];
intel_pstate_get_cpu_pstates(cpu); intel_pstate_get_cpu_pstates(cpu);
if (!cpu->pstate.current_pstate) {
all_cpu_data[cpunum] = NULL;
kfree(cpu);
return -ENODATA;
}
cpu->cpu = cpunum; cpu->cpu = cpunum;

View File

@ -65,7 +65,7 @@ static struct cpuidle_driver calxeda_idle_driver = {
.state_count = 2, .state_count = 2,
}; };
static int __init calxeda_cpuidle_probe(struct platform_device *pdev) static int calxeda_cpuidle_probe(struct platform_device *pdev)
{ {
return cpuidle_register(&calxeda_idle_driver, NULL); return cpuidle_register(&calxeda_idle_driver, NULL);
} }