mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
Revert "cpufreq: postfix policy directory with the first CPU in related_cpus"
Revert commit3510fac454
(cpufreq: postfix policy directory with the first CPU in related_cpus). Earlier, the policy->kobj was added to the kobject core, before ->init() callback was called for the cpufreq drivers. Which allowed those drivers to add or remove, driver dependent, sysfs files/directories to the same kobj from their ->init() and ->exit() callbacks. That isn't possible anymore after commit3510fac454
. Now, there is no other clean alternative that people can adopt. Its better to revert the earlier commit to allow cpufreq drivers to create/remove sysfs files from ->init() and ->exit() callbacks. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
ed757a2c7b
commit
edd4a893e0
1 changed files with 10 additions and 11 deletions
|
@ -985,6 +985,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct device *dev = get_cpu_device(cpu);
|
struct device *dev = get_cpu_device(cpu);
|
||||||
struct cpufreq_policy *policy;
|
struct cpufreq_policy *policy;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (WARN_ON(!dev))
|
if (WARN_ON(!dev))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1002,7 +1003,13 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
||||||
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
|
if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL))
|
||||||
goto err_free_rcpumask;
|
goto err_free_rcpumask;
|
||||||
|
|
||||||
kobject_init(&policy->kobj, &ktype_cpufreq);
|
ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
|
||||||
|
cpufreq_global_kobject, "policy%u", cpu);
|
||||||
|
if (ret) {
|
||||||
|
pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret);
|
||||||
|
goto err_free_real_cpus;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&policy->policy_list);
|
INIT_LIST_HEAD(&policy->policy_list);
|
||||||
init_rwsem(&policy->rwsem);
|
init_rwsem(&policy->rwsem);
|
||||||
spin_lock_init(&policy->transition_lock);
|
spin_lock_init(&policy->transition_lock);
|
||||||
|
@ -1013,6 +1020,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
|
||||||
policy->cpu = cpu;
|
policy->cpu = cpu;
|
||||||
return policy;
|
return policy;
|
||||||
|
|
||||||
|
err_free_real_cpus:
|
||||||
|
free_cpumask_var(policy->real_cpus);
|
||||||
err_free_rcpumask:
|
err_free_rcpumask:
|
||||||
free_cpumask_var(policy->related_cpus);
|
free_cpumask_var(policy->related_cpus);
|
||||||
err_free_cpumask:
|
err_free_cpumask:
|
||||||
|
@ -1117,16 +1126,6 @@ static int cpufreq_online(unsigned int cpu)
|
||||||
cpumask_copy(policy->related_cpus, policy->cpus);
|
cpumask_copy(policy->related_cpus, policy->cpus);
|
||||||
/* Remember CPUs present at the policy creation time. */
|
/* Remember CPUs present at the policy creation time. */
|
||||||
cpumask_and(policy->real_cpus, policy->cpus, cpu_present_mask);
|
cpumask_and(policy->real_cpus, policy->cpus, cpu_present_mask);
|
||||||
|
|
||||||
/* Name and add the kobject */
|
|
||||||
ret = kobject_add(&policy->kobj, cpufreq_global_kobject,
|
|
||||||
"policy%u",
|
|
||||||
cpumask_first(policy->related_cpus));
|
|
||||||
if (ret) {
|
|
||||||
pr_err("%s: failed to add policy->kobj: %d\n", __func__,
|
|
||||||
ret);
|
|
||||||
goto out_exit_policy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue