aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorCesar Eduardo Barros <cesarb@cesarb.net>2008-02-16 05:41:24 -0500
committerDave Jones <davej@redhat.com>2008-04-28 15:05:44 -0400
commit74212ca432982903d0fc6a0f282b199e000ad8b1 (patch)
tree3fb784de921c831cc85577ef7fc9750d1414f1e3 /drivers/cpufreq
parent457091181176643787a547dc04eb3cf5dcd822ce (diff)
[CPUFREQ] Warn when cpufreq_register_notifier called before pure initcalls
If cpufreq_register_notifier is called before pure initcalls, init_cpufreq_transition_notifier_list will overwrite whatever it did, causing notifiers to be ignored. Print some noise to the kernel log if that happens. Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net> Signed-off-by: Dave Jones <davej@codemonkey.org.uk>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index be78c07f72ca..d3575f5ec6d2 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -118,9 +118,11 @@ static void handle_update(struct work_struct *work);
118static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); 118static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list);
119static struct srcu_notifier_head cpufreq_transition_notifier_list; 119static struct srcu_notifier_head cpufreq_transition_notifier_list;
120 120
121static bool init_cpufreq_transition_notifier_list_called;
121static int __init init_cpufreq_transition_notifier_list(void) 122static int __init init_cpufreq_transition_notifier_list(void)
122{ 123{
123 srcu_init_notifier_head(&cpufreq_transition_notifier_list); 124 srcu_init_notifier_head(&cpufreq_transition_notifier_list);
125 init_cpufreq_transition_notifier_list_called = true;
124 return 0; 126 return 0;
125} 127}
126pure_initcall(init_cpufreq_transition_notifier_list); 128pure_initcall(init_cpufreq_transition_notifier_list);
@@ -1367,6 +1369,8 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
1367{ 1369{
1368 int ret; 1370 int ret;
1369 1371
1372 WARN_ON(!init_cpufreq_transition_notifier_list_called);
1373
1370 switch (list) { 1374 switch (list) {
1371 case CPUFREQ_TRANSITION_NOTIFIER: 1375 case CPUFREQ_TRANSITION_NOTIFIER:
1372 ret = srcu_notifier_chain_register( 1376 ret = srcu_notifier_chain_register(