Skip to content

Commit

Permalink
Merge branches 'pm-cpufreq' and 'pm-cpuidle'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Rafael J. Wysocki committed Dec 31, 2013
3 parents 4706515 + 98a947a + 3308d53 commit 0a405fe
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
37 changes: 23 additions & 14 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,6 @@ static void cpufreq_init_policy(struct cpufreq_policy *policy)

/* set default policy */
ret = cpufreq_set_policy(policy, &new_policy);
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;

if (ret) {
pr_debug("setting policy failed\n");
if (cpufreq_driver->exit)
Expand Down Expand Up @@ -1016,15 +1013,17 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
#endif

if (frozen)
/* Restore the saved policy when doing light-weight init */
policy = cpufreq_policy_restore(cpu);
else
/*
* Restore the saved policy when doing light-weight init and fall back
* to the full init if that fails.
*/
policy = frozen ? cpufreq_policy_restore(cpu) : NULL;
if (!policy) {
frozen = false;
policy = cpufreq_policy_alloc();

if (!policy)
goto nomem_out;

if (!policy)
goto nomem_out;
}

/*
* In the resume path, since we restore a saved policy, the assignment
Expand Down Expand Up @@ -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);

policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;
if (!frozen) {
policy->user_policy.min = policy->min;
policy->user_policy.max = policy->max;
}

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

cpufreq_init_policy(policy);

if (!frozen) {
policy->user_policy.policy = policy->policy;
policy->user_policy.governor = policy->governor;
}

kobject_uevent(&policy->kobj, KOBJ_ADD);
up_read(&cpufreq_rwsem);

Expand All @@ -1118,8 +1124,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif,
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);
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_free(policy);

nomem_out:
Expand Down
5 changes: 5 additions & 0 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
cpu = all_cpu_data[cpunum];

intel_pstate_get_cpu_pstates(cpu);
if (!cpu->pstate.current_pstate) {
all_cpu_data[cpunum] = NULL;
kfree(cpu);
return -ENODATA;
}

cpu->cpu = cpunum;

Expand Down
2 changes: 1 addition & 1 deletion drivers/cpuidle/cpuidle-calxeda.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static struct cpuidle_driver calxeda_idle_driver = {
.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);
}
Expand Down

0 comments on commit 0a405fe

Please sign in to comment.