diff options
| author | Satyam Sharma <satyam@infradead.org> | 2007-10-02 16:28:15 -0400 |
|---|---|---|
| committer | Dave Jones <davej@redhat.com> | 2007-10-04 18:40:57 -0400 |
| commit | 55395ae72b6e5ae614d28df74158c47454652583 (patch) | |
| tree | 1e78d5102b5ad87ae304103699c0c36b75627b41 /drivers/cpufreq | |
| parent | 6070b5de50ab5e3f810628a9cbb04deecf30a85f (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')
| -rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 917b9bab9c..8a45d0f93e 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 | ||
| 167 | static void | 167 | static void __cpuexit cpufreq_stats_free_table(unsigned int cpu) |
| 168 | cpufreq_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 | ||
| 308 | static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, | 307 | static 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 | ||
| 326 | static struct notifier_block cpufreq_stat_cpu_notifier = | 326 | static 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 | ||
| 380 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); | 378 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); |
| 381 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats" | 379 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats " |
| 382 | "through sysfs filesystem"); | 380 | "through sysfs filesystem"); |
| 383 | MODULE_LICENSE ("GPL"); | 381 | MODULE_LICENSE ("GPL"); |
| 384 | 382 | ||
