aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq_stats.c
diff options
context:
space:
mode:
authorSatyam Sharma <satyam@infradead.org>2007-10-02 16:28:15 -0400
committerDave Jones <davej@redhat.com>2007-10-04 18:40:57 -0400
commit55395ae72b6e5ae614d28df74158c47454652583 (patch)
tree1e78d5102b5ad87ae304103699c0c36b75627b41 /drivers/cpufreq/cpufreq_stats.c
parent6070b5de50ab5e3f810628a9cbb04deecf30a85f (diff)
[CPUFREQ] cpufreq_stats: misc cpuinit section annotations
* Stop referencing the callback directly from the __init and __exit functions of this driver, and instead explicitly call cpufreq_update_policy() et al. This enables the callback function to be marked as __cpuinit (and the notifier_block __cpuinitdata), thereby saving space when HOTPLUG_CPU=n. This also enables us to use other tricks to replace __cpuinit{data} in future. * cpufreq_stats_free_table() is only called from __cpuinit or __exit marked functions, making it an ideal candidate for __cpuexit. * Fix missing space in the module description Signed-off-by: Satyam Sharma <satyam@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_stats.c')
-rw-r--r--drivers/cpufreq/cpufreq_stats.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 917b9bab9ccb..8a45d0f93e26 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -164,8 +164,7 @@ freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq)
164 return -1; 164 return -1;
165} 165}
166 166
167static void 167static void __cpuexit cpufreq_stats_free_table(unsigned int cpu)
168cpufreq_stats_free_table (unsigned int cpu)
169{ 168{
170 struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; 169 struct cpufreq_stats *stat = cpufreq_stats_table[cpu];
171 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); 170 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
@@ -305,8 +304,9 @@ cpufreq_stat_notifier_trans (struct notifier_block *nb, unsigned long val,
305 return 0; 304 return 0;
306} 305}
307 306
308static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, 307static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
309 unsigned long action, void *hcpu) 308 unsigned long action,
309 void *hcpu)
310{ 310{
311 unsigned int cpu = (unsigned long)hcpu; 311 unsigned int cpu = (unsigned long)hcpu;
312 312
@@ -323,7 +323,7 @@ static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
323 return NOTIFY_OK; 323 return NOTIFY_OK;
324} 324}
325 325
326static struct notifier_block cpufreq_stat_cpu_notifier = 326static struct notifier_block cpufreq_stat_cpu_notifier __cpuinitdata =
327{ 327{
328 .notifier_call = cpufreq_stat_cpu_callback, 328 .notifier_call = cpufreq_stat_cpu_callback,
329}; 329};
@@ -356,8 +356,7 @@ __init cpufreq_stats_init(void)
356 356
357 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); 357 register_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
358 for_each_online_cpu(cpu) { 358 for_each_online_cpu(cpu) {
359 cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, 359 cpufreq_update_policy(cpu);
360 CPU_ONLINE, (void *)(long)cpu);
361 } 360 }
362 return 0; 361 return 0;
363} 362}
@@ -372,13 +371,12 @@ __exit cpufreq_stats_exit(void)
372 CPUFREQ_TRANSITION_NOTIFIER); 371 CPUFREQ_TRANSITION_NOTIFIER);
373 unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); 372 unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
374 for_each_online_cpu(cpu) { 373 for_each_online_cpu(cpu) {
375 cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, 374 cpufreq_stats_free_table(cpu);
376 CPU_DEAD, (void *)(long)cpu);
377 } 375 }
378} 376}
379 377
380MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); 378MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>");
381MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats" 379MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats "
382 "through sysfs filesystem"); 380 "through sysfs filesystem");
383MODULE_LICENSE ("GPL"); 381MODULE_LICENSE ("GPL");
384 382