diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-01-06 20:40:11 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-01-16 20:00:43 -0500 |
commit | 027cc2e4a6127fdf29e17a422aacb5ecd9830cbb (patch) | |
tree | 440248d6535219375e9dd41d2a6617169750232a /drivers | |
parent | fcd7af917abba798cd954419030142e95139359f (diff) |
cpufreq: stats: remove hotplug notifiers
Either CPUs are hot-unplugged or suspend/resume occurs, cpufreq core
will send notifications to cpufreq-stats and stats structure and sysfs
entries would be correctly handled..
And so we don't actually need hotcpu notifiers in cpufreq-stats anymore.
We were only handling cpu hot-unplug events here and that are already
taken care of by POLICY notifiers.
Acked-by: Nicolas Pitre <nico@linaro.org>
Tested-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 0f7156252453..8fa58440ea95 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -294,11 +294,8 @@ static int cpufreq_stat_notifier_policy(struct notifier_block *nb, | |||
294 | if (val == CPUFREQ_CREATE_POLICY) | 294 | if (val == CPUFREQ_CREATE_POLICY) |
295 | ret = cpufreq_stats_create_table(policy, table); | 295 | ret = cpufreq_stats_create_table(policy, table); |
296 | else if (val == CPUFREQ_REMOVE_POLICY) { | 296 | else if (val == CPUFREQ_REMOVE_POLICY) { |
297 | /* This might already be freed by cpu hotplug notifier */ | 297 | cpufreq_stats_free_sysfs(cpu); |
298 | if (per_cpu(cpufreq_stats_table, cpu)) { | 298 | cpufreq_stats_free_table(cpu); |
299 | cpufreq_stats_free_sysfs(cpu); | ||
300 | cpufreq_stats_free_table(cpu); | ||
301 | } | ||
302 | } | 299 | } |
303 | 300 | ||
304 | return ret; | 301 | return ret; |
@@ -340,33 +337,6 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, | |||
340 | return 0; | 337 | return 0; |
341 | } | 338 | } |
342 | 339 | ||
343 | static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, | ||
344 | unsigned long action, | ||
345 | void *hcpu) | ||
346 | { | ||
347 | unsigned int cpu = (unsigned long)hcpu; | ||
348 | |||
349 | /* Don't free/allocate stats during suspend/resume */ | ||
350 | if (action & CPU_TASKS_FROZEN) | ||
351 | return 0; | ||
352 | |||
353 | switch (action) { | ||
354 | case CPU_DOWN_PREPARE: | ||
355 | cpufreq_stats_free_sysfs(cpu); | ||
356 | break; | ||
357 | case CPU_DEAD: | ||
358 | cpufreq_stats_free_table(cpu); | ||
359 | break; | ||
360 | } | ||
361 | return NOTIFY_OK; | ||
362 | } | ||
363 | |||
364 | /* priority=1 so this will get called before cpufreq_remove_dev */ | ||
365 | static struct notifier_block cpufreq_stat_cpu_notifier __refdata = { | ||
366 | .notifier_call = cpufreq_stat_cpu_callback, | ||
367 | .priority = 1, | ||
368 | }; | ||
369 | |||
370 | static struct notifier_block notifier_policy_block = { | 340 | static struct notifier_block notifier_policy_block = { |
371 | .notifier_call = cpufreq_stat_notifier_policy | 341 | .notifier_call = cpufreq_stat_notifier_policy |
372 | }; | 342 | }; |
@@ -386,14 +356,11 @@ static int __init cpufreq_stats_init(void) | |||
386 | if (ret) | 356 | if (ret) |
387 | return ret; | 357 | return ret; |
388 | 358 | ||
389 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | ||
390 | |||
391 | ret = cpufreq_register_notifier(¬ifier_trans_block, | 359 | ret = cpufreq_register_notifier(¬ifier_trans_block, |
392 | CPUFREQ_TRANSITION_NOTIFIER); | 360 | CPUFREQ_TRANSITION_NOTIFIER); |
393 | if (ret) { | 361 | if (ret) { |
394 | cpufreq_unregister_notifier(¬ifier_policy_block, | 362 | cpufreq_unregister_notifier(¬ifier_policy_block, |
395 | CPUFREQ_POLICY_NOTIFIER); | 363 | CPUFREQ_POLICY_NOTIFIER); |
396 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | ||
397 | for_each_online_cpu(cpu) | 364 | for_each_online_cpu(cpu) |
398 | cpufreq_stats_free_table(cpu); | 365 | cpufreq_stats_free_table(cpu); |
399 | return ret; | 366 | return ret; |
@@ -409,7 +376,6 @@ static void __exit cpufreq_stats_exit(void) | |||
409 | CPUFREQ_POLICY_NOTIFIER); | 376 | CPUFREQ_POLICY_NOTIFIER); |
410 | cpufreq_unregister_notifier(¬ifier_trans_block, | 377 | cpufreq_unregister_notifier(¬ifier_trans_block, |
411 | CPUFREQ_TRANSITION_NOTIFIER); | 378 | CPUFREQ_TRANSITION_NOTIFIER); |
412 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | ||
413 | for_each_online_cpu(cpu) { | 379 | for_each_online_cpu(cpu) { |
414 | cpufreq_stats_free_table(cpu); | 380 | cpufreq_stats_free_table(cpu); |
415 | cpufreq_stats_free_sysfs(cpu); | 381 | cpufreq_stats_free_sysfs(cpu); |