qcom-cpufreq: Remove per-cpu workqueue

It's no longer a requirement to pin frequency change on the CPU that
is being scaled. Therefore, there is no longer a need for per-cpu
workqueue in qcom-cpufreq. Remove the workqueue.

Change-Id: Ic6fd7f898fa8b1b1226a178b04530c24f0398daa
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
This commit is contained in:
Junjie Wu 2014-06-20 18:23:54 -07:00 committed by David Keitel
parent a80a914583
commit 9c69b365d2

View file

@ -20,8 +20,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/sched.h> #include <linux/sched.h>
@ -40,18 +38,6 @@ static struct clk *l2_clk;
static DEFINE_PER_CPU(struct cpufreq_frequency_table *, freq_table); static DEFINE_PER_CPU(struct cpufreq_frequency_table *, freq_table);
static bool hotplug_ready; static bool hotplug_ready;
struct cpufreq_work_struct {
struct work_struct work;
struct cpufreq_policy *policy;
struct completion complete;
int frequency;
unsigned int index;
int status;
};
static DEFINE_PER_CPU(struct cpufreq_work_struct, cpufreq_work);
static struct workqueue_struct *msm_cpufreq_wq;
struct cpufreq_suspend_t { struct cpufreq_suspend_t {
struct mutex suspend_mutex; struct mutex suspend_mutex;
int device_suspended; int device_suspended;
@ -104,16 +90,6 @@ static int set_cpu_freq(struct cpufreq_policy *policy, unsigned int new_freq,
return ret; return ret;
} }
static void set_cpu_work(struct work_struct *work)
{
struct cpufreq_work_struct *cpu_work =
container_of(work, struct cpufreq_work_struct, work);
cpu_work->status = set_cpu_freq(cpu_work->policy, cpu_work->frequency,
cpu_work->index);
complete(&cpu_work->complete);
}
static int msm_cpufreq_target(struct cpufreq_policy *policy, static int msm_cpufreq_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation) unsigned int relation)
@ -122,8 +98,6 @@ static int msm_cpufreq_target(struct cpufreq_policy *policy,
int index; int index;
struct cpufreq_frequency_table *table; struct cpufreq_frequency_table *table;
struct cpufreq_work_struct *cpu_work = NULL;
mutex_lock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex); mutex_lock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex);
if (per_cpu(cpufreq_suspend, policy->cpu).device_suspended) { if (per_cpu(cpufreq_suspend, policy->cpu).device_suspended) {
@ -145,19 +119,8 @@ static int msm_cpufreq_target(struct cpufreq_policy *policy,
policy->cpu, target_freq, relation, policy->cpu, target_freq, relation,
policy->min, policy->max, table[index].frequency); policy->min, policy->max, table[index].frequency);
cpu_work = &per_cpu(cpufreq_work, policy->cpu); ret = set_cpu_freq(policy, table[index].frequency,
cpu_work->policy = policy; table[index].driver_data);
cpu_work->frequency = table[index].frequency;
cpu_work->index = table[index].driver_data;
cpu_work->status = -ENODEV;
cancel_work_sync(&cpu_work->work);
reinit_completion(&cpu_work->complete);
queue_work_on(policy->cpu, msm_cpufreq_wq, &cpu_work->work);
wait_for_completion(&cpu_work->complete);
ret = cpu_work->status;
done: done:
mutex_unlock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex); mutex_unlock(&per_cpu(cpufreq_suspend, policy->cpu).suspend_mutex);
return ret; return ret;
@ -182,7 +145,6 @@ static int msm_cpufreq_init(struct cpufreq_policy *policy)
int ret = 0; int ret = 0;
struct cpufreq_frequency_table *table = struct cpufreq_frequency_table *table =
per_cpu(freq_table, policy->cpu); per_cpu(freq_table, policy->cpu);
struct cpufreq_work_struct *cpu_work = NULL;
int cpu; int cpu;
/* /*
@ -191,14 +153,9 @@ static int msm_cpufreq_init(struct cpufreq_policy *policy)
* CPUs that share same clock, and mark them as controlled by * CPUs that share same clock, and mark them as controlled by
* same policy. * same policy.
*/ */
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu)
if (cpu_clk[cpu] == cpu_clk[policy->cpu]) { if (cpu_clk[cpu] == cpu_clk[policy->cpu])
cpumask_set_cpu(cpu, policy->cpus); cpumask_set_cpu(cpu, policy->cpus);
cpu_work = &per_cpu(cpufreq_work, cpu);
INIT_WORK(&cpu_work->work, set_cpu_work);
init_completion(&cpu_work->complete);
}
}
if (cpufreq_frequency_table_cpuinfo(policy, table)) if (cpufreq_frequency_table_cpuinfo(policy, table))
pr_err("cpufreq: failed to get policy min/max\n"); pr_err("cpufreq: failed to get policy min/max\n");
@ -521,7 +478,6 @@ static int __init msm_cpufreq_register(void)
return rc; return rc;
} }
msm_cpufreq_wq = alloc_workqueue("msm-cpufreq", WQ_HIGHPRI, 0);
register_pm_notifier(&msm_cpufreq_pm_notifier); register_pm_notifier(&msm_cpufreq_pm_notifier);
return cpufreq_register_driver(&msm_cpufreq_driver); return cpufreq_register_driver(&msm_cpufreq_driver);
} }