Commit a34e63b1 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

cpufreq: Pass CPU number to cpufreq_policy_alloc()

Change cpufreq_policy_alloc() to take a CPU number instead of a CPU
device pointer as its argument, as it is the only function called by
cpufreq_add_dev() taking a device pointer argument at this point.

That will allow us to split the CPU online part from cpufreq_add_dev()
more cleanly going forward.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 4d1f3a5b
...@@ -1090,11 +1090,15 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp ...@@ -1090,11 +1090,15 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy, unsigned int cp
return 0; return 0;
} }
static struct cpufreq_policy *cpufreq_policy_alloc(struct device *dev) static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu)
{ {
struct device *dev = get_cpu_device(cpu);
struct cpufreq_policy *policy; struct cpufreq_policy *policy;
int ret; int ret;
if (WARN_ON(!dev))
return NULL;
policy = kzalloc(sizeof(*policy), GFP_KERNEL); policy = kzalloc(sizeof(*policy), GFP_KERNEL);
if (!policy) if (!policy)
return NULL; return NULL;
...@@ -1122,10 +1126,10 @@ static struct cpufreq_policy *cpufreq_policy_alloc(struct device *dev) ...@@ -1122,10 +1126,10 @@ static struct cpufreq_policy *cpufreq_policy_alloc(struct device *dev)
init_completion(&policy->kobj_unregister); init_completion(&policy->kobj_unregister);
INIT_WORK(&policy->update, handle_update); INIT_WORK(&policy->update, handle_update);
policy->cpu = dev->id; policy->cpu = cpu;
/* Set this once on allocation */ /* Set this once on allocation */
policy->kobj_cpu = dev->id; policy->kobj_cpu = cpu;
return policy; return policy;
...@@ -1233,7 +1237,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) ...@@ -1233,7 +1237,7 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
up_write(&policy->rwsem); up_write(&policy->rwsem);
} else { } else {
recover_policy = false; recover_policy = false;
policy = cpufreq_policy_alloc(dev); policy = cpufreq_policy_alloc(cpu);
if (!policy) if (!policy)
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment