Message ID | 1388136651-21883-1-git-send-email-jiel@marvell.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
On 27 December 2013 15:00, <jiel@marvell.com> wrote: > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > -static DEFINE_MUTEX(cpufreq_governor_lock); > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index dc196bb..4faafe7 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -254,6 +254,7 @@ struct cpufreq_driver { > > int cpufreq_register_driver(struct cpufreq_driver *driver_data); > int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); > +static DEFINE_MUTEX(cpufreq_governor_lock); No way, this would never work. This would create separate locks in each file that includes cpufreq.h. And so the locks you are talking about wouldn't protect governor. Have you actually tested this code? If this fixes the breakage you saw? If this fixes it then you need to do better investigation of your problem.. you actually need to remove the static keyword from cpufreq.c file. Nothing else. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02d534d..50601f6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -39,7 +39,6 @@ static struct cpufreq_driver *cpufreq_driver; static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data); static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback); static DEFINE_RWLOCK(cpufreq_driver_lock); -static DEFINE_MUTEX(cpufreq_governor_lock); static LIST_HEAD(cpufreq_policy_list); #ifdef CONFIG_HOTPLUG_CPU diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index e6be635..11b9f0b 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -119,8 +119,11 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, { int i; - if (!policy->governor_enabled) + mutex_lock(&cpufreq_governor_lock); + if (!policy->governor_enabled) { + mutex_unlock(&cpufreq_governor_lock); return; + } if (!all_cpus) { /* @@ -135,6 +138,7 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy, for_each_cpu(i, policy->cpus) __gov_queue_work(i, dbs_data, delay); } + mutex_unlock(&cpufreq_governor_lock); } EXPORT_SYMBOL_GPL(gov_queue_work); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index dc196bb..4faafe7 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -254,6 +254,7 @@ struct cpufreq_driver { int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); +static DEFINE_MUTEX(cpufreq_governor_lock); const char *cpufreq_get_current_driver(void);