cpufreq: Track cpu managing sysfs kobjects separately
In order to prepare for the next few commits, that will stop migrating sysfs files on cpu hotplug, this patch starts managing sysfs-cpu separately. The behavior is still the same as we are still migrating sysfs files on hotplug, later commits would change that. Signed-off-by: Saravana Kannan <skannan@codeaurora.org> 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
58405af632
commit
9d16f20711
|
@ -959,7 +959,7 @@ static int cpufreq_add_dev_symlink(struct cpufreq_policy *policy)
|
||||||
for_each_cpu(j, policy->cpus) {
|
for_each_cpu(j, policy->cpus) {
|
||||||
struct device *cpu_dev;
|
struct device *cpu_dev;
|
||||||
|
|
||||||
if (j == policy->cpu)
|
if (j == policy->kobj_cpu)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pr_debug("Adding link for CPU: %u\n", j);
|
pr_debug("Adding link for CPU: %u\n", j);
|
||||||
|
@ -1178,6 +1178,7 @@ static int update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu,
|
||||||
|
|
||||||
down_write(&policy->rwsem);
|
down_write(&policy->rwsem);
|
||||||
policy->cpu = cpu;
|
policy->cpu = cpu;
|
||||||
|
policy->kobj_cpu = cpu;
|
||||||
up_write(&policy->rwsem);
|
up_write(&policy->rwsem);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1235,10 +1236,12 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
|
||||||
* the creation of a brand new one. So we need to perform this update
|
* the creation of a brand new one. So we need to perform this update
|
||||||
* by invoking update_policy_cpu().
|
* by invoking update_policy_cpu().
|
||||||
*/
|
*/
|
||||||
if (recover_policy && cpu != policy->cpu)
|
if (recover_policy && cpu != policy->cpu) {
|
||||||
WARN_ON(update_policy_cpu(policy, cpu, dev));
|
WARN_ON(update_policy_cpu(policy, cpu, dev));
|
||||||
else
|
} else {
|
||||||
policy->cpu = cpu;
|
policy->cpu = cpu;
|
||||||
|
policy->kobj_cpu = cpu;
|
||||||
|
}
|
||||||
|
|
||||||
cpumask_copy(policy->cpus, cpumask_of(cpu));
|
cpumask_copy(policy->cpus, cpumask_of(cpu));
|
||||||
|
|
||||||
|
@ -1417,7 +1420,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev,
|
||||||
CPUFREQ_NAME_LEN);
|
CPUFREQ_NAME_LEN);
|
||||||
up_write(&policy->rwsem);
|
up_write(&policy->rwsem);
|
||||||
|
|
||||||
if (cpu != policy->cpu) {
|
if (cpu != policy->kobj_cpu) {
|
||||||
sysfs_remove_link(&dev->kobj, "cpufreq");
|
sysfs_remove_link(&dev->kobj, "cpufreq");
|
||||||
} else if (cpus > 1) {
|
} else if (cpus > 1) {
|
||||||
/* Nominate new CPU */
|
/* Nominate new CPU */
|
||||||
|
|
|
@ -65,7 +65,9 @@ struct cpufreq_policy {
|
||||||
|
|
||||||
unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs
|
unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs
|
||||||
should set cpufreq */
|
should set cpufreq */
|
||||||
unsigned int cpu; /* cpu nr of CPU managing this policy */
|
unsigned int cpu; /* cpu managing this policy, must be online */
|
||||||
|
unsigned int kobj_cpu; /* cpu managing sysfs files, can be offline */
|
||||||
|
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct cpufreq_cpuinfo cpuinfo;/* see above */
|
struct cpufreq_cpuinfo cpuinfo;/* see above */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue