]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[CPUFREQ] Warn when cpufreq_register_notifier called before pure initcalls
authorCesar Eduardo Barros <cesarb@cesarb.net>
Sat, 16 Feb 2008 10:41:24 +0000 (08:41 -0200)
committerDave Jones <davej@redhat.com>
Mon, 28 Apr 2008 19:05:44 +0000 (15:05 -0400)
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>
drivers/cpufreq/cpufreq.c

index be78c07f72cae230bfe08b19996969bd2194e74b..d3575f5ec6d23be5dbd1fe76d275e1c10b56a9e1 100644 (file)
@@ -118,9 +118,11 @@ static void handle_update(struct work_struct *work);
 static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list);
 static struct srcu_notifier_head cpufreq_transition_notifier_list;
 
+static bool init_cpufreq_transition_notifier_list_called;
 static int __init init_cpufreq_transition_notifier_list(void)
 {
        srcu_init_notifier_head(&cpufreq_transition_notifier_list);
+       init_cpufreq_transition_notifier_list_called = true;
        return 0;
 }
 pure_initcall(init_cpufreq_transition_notifier_list);
@@ -1367,6 +1369,8 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
 {
        int ret;
 
+       WARN_ON(!init_cpufreq_transition_notifier_list_called);
+
        switch (list) {
        case CPUFREQ_TRANSITION_NOTIFIER:
                ret = srcu_notifier_chain_register(