diff options
author | Christian Krafft <krafft@de.ibm.com> | 2007-07-20 15:39:20 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@klappe.arndb.de> | 2007-07-20 15:41:36 -0400 |
commit | e5ecc8719212e2566440818491ec5741689f3743 (patch) | |
tree | 62bcda88cc4fe809b38549695262905edd664e09 /arch/powerpc/platforms/cell/cbe_cpufreq.c | |
parent | a964b9be3e475f30aee334654b4ff200bcdc0092 (diff) |
[CELL] cbe_cpufreq: fix initialization
This patch fixes the initialization of the cbe_cpufreq driver.
The code that initializes the PMI related functions was called per cpu:
* registering cpufreq notifier block
* registering a pmi handler
This ends in a bug that the notifier block gets called in an endless loop.
The initialization code is being put to the
module init code path by this patch. This way it only gets called once.
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc/platforms/cell/cbe_cpufreq.c')
-rw-r--r-- | arch/powerpc/platforms/cell/cbe_cpufreq.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index 5820fb9a4521..3a26b3c115b9 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c | |||
@@ -196,10 +196,9 @@ static int pmi_notifier(struct notifier_block *nb, | |||
196 | { | 196 | { |
197 | struct cpufreq_policy *policy = data; | 197 | struct cpufreq_policy *policy = data; |
198 | 198 | ||
199 | if (event != CPUFREQ_INCOMPATIBLE) | 199 | if (pmi_frequency_limit) |
200 | return 0; | 200 | cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit); |
201 | 201 | ||
202 | cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit); | ||
203 | return 0; | 202 | return 0; |
204 | } | 203 | } |
205 | 204 | ||
@@ -263,11 +262,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
263 | 262 | ||
264 | cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); | 263 | cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); |
265 | 264 | ||
266 | if (cbe_cpufreq_has_pmi) { | ||
267 | /* frequency might get limited later, initialize limit with max_freq */ | ||
268 | pmi_frequency_limit = max_freq; | ||
269 | cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
270 | } | ||
271 | 265 | ||
272 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ | 266 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ |
273 | return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); | 267 | return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); |
@@ -275,9 +269,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
275 | 269 | ||
276 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) | 270 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
277 | { | 271 | { |
278 | if (cbe_cpufreq_has_pmi) | ||
279 | cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
280 | |||
281 | cpufreq_frequency_table_put_attr(policy->cpu); | 272 | cpufreq_frequency_table_put_attr(policy->cpu); |
282 | return 0; | 273 | return 0; |
283 | } | 274 | } |
@@ -341,6 +332,9 @@ static int __init cbe_cpufreq_init(void) | |||
341 | 332 | ||
342 | cbe_cpufreq_has_pmi = pmi_register_handler(&cbe_pmi_handler) == 0; | 333 | cbe_cpufreq_has_pmi = pmi_register_handler(&cbe_pmi_handler) == 0; |
343 | 334 | ||
335 | if (cbe_cpufreq_has_pmi) | ||
336 | cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
337 | |||
344 | return cpufreq_register_driver(&cbe_cpufreq_driver); | 338 | return cpufreq_register_driver(&cbe_cpufreq_driver); |
345 | } | 339 | } |
346 | 340 | ||
@@ -348,8 +342,10 @@ static void __exit cbe_cpufreq_exit(void) | |||
348 | { | 342 | { |
349 | cpufreq_unregister_driver(&cbe_cpufreq_driver); | 343 | cpufreq_unregister_driver(&cbe_cpufreq_driver); |
350 | 344 | ||
351 | if (cbe_cpufreq_has_pmi) | 345 | if (cbe_cpufreq_has_pmi) { |
346 | cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
352 | pmi_unregister_handler(&cbe_pmi_handler); | 347 | pmi_unregister_handler(&cbe_pmi_handler); |
348 | } | ||
353 | } | 349 | } |
354 | 350 | ||
355 | module_init(cbe_cpufreq_init); | 351 | module_init(cbe_cpufreq_init); |