Commit 74212ca4 authored by Cesar Eduardo Barros's avatar Cesar Eduardo Barros Committed by Dave Jones

[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: default avatarCesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: default avatarDave Jones <davej@codemonkey.org.uk>
parent 45709118
...@@ -118,9 +118,11 @@ static void handle_update(struct work_struct *work); ...@@ -118,9 +118,11 @@ static void handle_update(struct work_struct *work);
static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list); static BLOCKING_NOTIFIER_HEAD(cpufreq_policy_notifier_list);
static struct srcu_notifier_head cpufreq_transition_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) static int __init init_cpufreq_transition_notifier_list(void)
{ {
srcu_init_notifier_head(&cpufreq_transition_notifier_list); srcu_init_notifier_head(&cpufreq_transition_notifier_list);
init_cpufreq_transition_notifier_list_called = true;
return 0; return 0;
} }
pure_initcall(init_cpufreq_transition_notifier_list); pure_initcall(init_cpufreq_transition_notifier_list);
...@@ -1367,6 +1369,8 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list) ...@@ -1367,6 +1369,8 @@ int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list)
{ {
int ret; int ret;
WARN_ON(!init_cpufreq_transition_notifier_list_called);
switch (list) { switch (list) {
case CPUFREQ_TRANSITION_NOTIFIER: case CPUFREQ_TRANSITION_NOTIFIER:
ret = srcu_notifier_chain_register( ret = srcu_notifier_chain_register(
......
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