diff options
author | Dave Jones <davej@redhat.com> | 2007-02-05 19:12:43 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2007-02-10 20:01:47 -0500 |
commit | c120069779e3e35917c15393cf2847fa79811eb6 (patch) | |
tree | 9e1e5529b43c151ecc9d3743e5b51ff88eb52312 /drivers/cpufreq | |
parent | 86acd49aa128bd7a1d4362c256c21fbdc2d5b1a0 (diff) |
[CPUFREQ] Remove hotplug cpu crap
The hotplug CPU locking in cpufreq is horrendous. No-one seems to care
enough to fix it, so just remove it so that the 99.9% of the real world
users of this code can use cpufreq without being bothered by warnings.
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.c | 16 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 2 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_userspace.c | 2 |
5 files changed, 0 insertions, 24 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a45cc89e387a..9bdcdbdcc0ad 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -415,12 +415,10 @@ static ssize_t store_##file_name \ | |||
415 | if (ret != 1) \ | 415 | if (ret != 1) \ |
416 | return -EINVAL; \ | 416 | return -EINVAL; \ |
417 | \ | 417 | \ |
418 | lock_cpu_hotplug(); \ | ||
419 | mutex_lock(&policy->lock); \ | 418 | mutex_lock(&policy->lock); \ |
420 | ret = __cpufreq_set_policy(policy, &new_policy); \ | 419 | ret = __cpufreq_set_policy(policy, &new_policy); \ |
421 | policy->user_policy.object = policy->object; \ | 420 | policy->user_policy.object = policy->object; \ |
422 | mutex_unlock(&policy->lock); \ | 421 | mutex_unlock(&policy->lock); \ |
423 | unlock_cpu_hotplug(); \ | ||
424 | \ | 422 | \ |
425 | return ret ? ret : count; \ | 423 | return ret ? ret : count; \ |
426 | } | 424 | } |
@@ -479,8 +477,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
479 | &new_policy.governor)) | 477 | &new_policy.governor)) |
480 | return -EINVAL; | 478 | return -EINVAL; |
481 | 479 | ||
482 | lock_cpu_hotplug(); | ||
483 | |||
484 | /* Do not use cpufreq_set_policy here or the user_policy.max | 480 | /* Do not use cpufreq_set_policy here or the user_policy.max |
485 | will be wrongly overridden */ | 481 | will be wrongly overridden */ |
486 | mutex_lock(&policy->lock); | 482 | mutex_lock(&policy->lock); |
@@ -490,8 +486,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy, | |||
490 | policy->user_policy.governor = policy->governor; | 486 | policy->user_policy.governor = policy->governor; |
491 | mutex_unlock(&policy->lock); | 487 | mutex_unlock(&policy->lock); |
492 | 488 | ||
493 | unlock_cpu_hotplug(); | ||
494 | |||
495 | if (ret) | 489 | if (ret) |
496 | return ret; | 490 | return ret; |
497 | else | 491 | else |
@@ -1278,7 +1272,6 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier); | |||
1278 | *********************************************************************/ | 1272 | *********************************************************************/ |
1279 | 1273 | ||
1280 | 1274 | ||
1281 | /* Must be called with lock_cpu_hotplug held */ | ||
1282 | int __cpufreq_driver_target(struct cpufreq_policy *policy, | 1275 | int __cpufreq_driver_target(struct cpufreq_policy *policy, |
1283 | unsigned int target_freq, | 1276 | unsigned int target_freq, |
1284 | unsigned int relation) | 1277 | unsigned int relation) |
@@ -1304,13 +1297,11 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1304 | if (!policy) | 1297 | if (!policy) |
1305 | return -EINVAL; | 1298 | return -EINVAL; |
1306 | 1299 | ||
1307 | lock_cpu_hotplug(); | ||
1308 | mutex_lock(&policy->lock); | 1300 | mutex_lock(&policy->lock); |
1309 | 1301 | ||
1310 | ret = __cpufreq_driver_target(policy, target_freq, relation); | 1302 | ret = __cpufreq_driver_target(policy, target_freq, relation); |
1311 | 1303 | ||
1312 | mutex_unlock(&policy->lock); | 1304 | mutex_unlock(&policy->lock); |
1313 | unlock_cpu_hotplug(); | ||
1314 | 1305 | ||
1315 | cpufreq_cpu_put(policy); | 1306 | cpufreq_cpu_put(policy); |
1316 | return ret; | 1307 | return ret; |
@@ -1338,7 +1329,6 @@ int cpufreq_driver_getavg(struct cpufreq_policy *policy) | |||
1338 | EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); | 1329 | EXPORT_SYMBOL_GPL(cpufreq_driver_getavg); |
1339 | 1330 | ||
1340 | /* | 1331 | /* |
1341 | * Locking: Must be called with the lock_cpu_hotplug() lock held | ||
1342 | * when "event" is CPUFREQ_GOV_LIMITS | 1332 | * when "event" is CPUFREQ_GOV_LIMITS |
1343 | */ | 1333 | */ |
1344 | 1334 | ||
@@ -1433,7 +1423,6 @@ EXPORT_SYMBOL(cpufreq_get_policy); | |||
1433 | /* | 1423 | /* |
1434 | * data : current policy. | 1424 | * data : current policy. |
1435 | * policy : policy to be set. | 1425 | * policy : policy to be set. |
1436 | * Locking: Must be called with the lock_cpu_hotplug() lock held | ||
1437 | */ | 1426 | */ |
1438 | static int __cpufreq_set_policy(struct cpufreq_policy *data, | 1427 | static int __cpufreq_set_policy(struct cpufreq_policy *data, |
1439 | struct cpufreq_policy *policy) | 1428 | struct cpufreq_policy *policy) |
@@ -1539,8 +1528,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1539 | if (!data) | 1528 | if (!data) |
1540 | return -EINVAL; | 1529 | return -EINVAL; |
1541 | 1530 | ||
1542 | lock_cpu_hotplug(); | ||
1543 | |||
1544 | /* lock this CPU */ | 1531 | /* lock this CPU */ |
1545 | mutex_lock(&data->lock); | 1532 | mutex_lock(&data->lock); |
1546 | 1533 | ||
@@ -1552,7 +1539,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy) | |||
1552 | 1539 | ||
1553 | mutex_unlock(&data->lock); | 1540 | mutex_unlock(&data->lock); |
1554 | 1541 | ||
1555 | unlock_cpu_hotplug(); | ||
1556 | cpufreq_cpu_put(data); | 1542 | cpufreq_cpu_put(data); |
1557 | 1543 | ||
1558 | return ret; | 1544 | return ret; |
@@ -1576,7 +1562,6 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1576 | if (!data) | 1562 | if (!data) |
1577 | return -ENODEV; | 1563 | return -ENODEV; |
1578 | 1564 | ||
1579 | lock_cpu_hotplug(); | ||
1580 | mutex_lock(&data->lock); | 1565 | mutex_lock(&data->lock); |
1581 | 1566 | ||
1582 | dprintk("updating policy for CPU %u\n", cpu); | 1567 | dprintk("updating policy for CPU %u\n", cpu); |
@@ -1603,7 +1588,6 @@ int cpufreq_update_policy(unsigned int cpu) | |||
1603 | ret = __cpufreq_set_policy(data, &policy); | 1588 | ret = __cpufreq_set_policy(data, &policy); |
1604 | 1589 | ||
1605 | mutex_unlock(&data->lock); | 1590 | mutex_unlock(&data->lock); |
1606 | unlock_cpu_hotplug(); | ||
1607 | cpufreq_cpu_put(data); | 1591 | cpufreq_cpu_put(data); |
1608 | return ret; | 1592 | return ret; |
1609 | } | 1593 | } |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index eef0270c6f3d..787e8417c106 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -430,14 +430,12 @@ static void dbs_check_cpu(int cpu) | |||
430 | static void do_dbs_timer(struct work_struct *work) | 430 | static void do_dbs_timer(struct work_struct *work) |
431 | { | 431 | { |
432 | int i; | 432 | int i; |
433 | lock_cpu_hotplug(); | ||
434 | mutex_lock(&dbs_mutex); | 433 | mutex_lock(&dbs_mutex); |
435 | for_each_online_cpu(i) | 434 | for_each_online_cpu(i) |
436 | dbs_check_cpu(i); | 435 | dbs_check_cpu(i); |
437 | schedule_delayed_work(&dbs_work, | 436 | schedule_delayed_work(&dbs_work, |
438 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 437 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
439 | mutex_unlock(&dbs_mutex); | 438 | mutex_unlock(&dbs_mutex); |
440 | unlock_cpu_hotplug(); | ||
441 | } | 439 | } |
442 | 440 | ||
443 | static inline void dbs_timer_init(void) | 441 | static inline void dbs_timer_init(void) |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index f697449327c6..d52f9b426521 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -440,9 +440,7 @@ static void do_dbs_timer(struct work_struct *work) | |||
440 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | 440 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
441 | if (!dbs_tuners_ins.powersave_bias || | 441 | if (!dbs_tuners_ins.powersave_bias || |
442 | sample_type == DBS_NORMAL_SAMPLE) { | 442 | sample_type == DBS_NORMAL_SAMPLE) { |
443 | lock_cpu_hotplug(); | ||
444 | dbs_check_cpu(dbs_info); | 443 | dbs_check_cpu(dbs_info); |
445 | unlock_cpu_hotplug(); | ||
446 | if (dbs_info->freq_lo) { | 444 | if (dbs_info->freq_lo) { |
447 | /* Setup timer for SUB_SAMPLE */ | 445 | /* Setup timer for SUB_SAMPLE */ |
448 | dbs_info->sample_type = DBS_SUB_SAMPLE; | 446 | dbs_info->sample_type = DBS_SUB_SAMPLE; |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 91ad342a6051..d1c7cac9316c 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -370,12 +370,10 @@ __exit cpufreq_stats_exit(void) | |||
370 | cpufreq_unregister_notifier(¬ifier_trans_block, | 370 | cpufreq_unregister_notifier(¬ifier_trans_block, |
371 | CPUFREQ_TRANSITION_NOTIFIER); | 371 | CPUFREQ_TRANSITION_NOTIFIER); |
372 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 372 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
373 | lock_cpu_hotplug(); | ||
374 | for_each_online_cpu(cpu) { | 373 | for_each_online_cpu(cpu) { |
375 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, | 374 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, |
376 | CPU_DEAD, (void *)(long)cpu); | 375 | CPU_DEAD, (void *)(long)cpu); |
377 | } | 376 | } |
378 | unlock_cpu_hotplug(); | ||
379 | } | 377 | } |
380 | 378 | ||
381 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); | 379 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); |
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c index 2a4eb0bfaf30..860345c7799a 100644 --- a/drivers/cpufreq/cpufreq_userspace.c +++ b/drivers/cpufreq/cpufreq_userspace.c | |||
@@ -71,7 +71,6 @@ static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy) | |||
71 | 71 | ||
72 | dprintk("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq); | 72 | dprintk("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq); |
73 | 73 | ||
74 | lock_cpu_hotplug(); | ||
75 | mutex_lock(&userspace_mutex); | 74 | mutex_lock(&userspace_mutex); |
76 | if (!cpu_is_managed[policy->cpu]) | 75 | if (!cpu_is_managed[policy->cpu]) |
77 | goto err; | 76 | goto err; |
@@ -94,7 +93,6 @@ static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy) | |||
94 | 93 | ||
95 | err: | 94 | err: |
96 | mutex_unlock(&userspace_mutex); | 95 | mutex_unlock(&userspace_mutex); |
97 | unlock_cpu_hotplug(); | ||
98 | return ret; | 96 | return ret; |
99 | } | 97 | } |
100 | 98 | ||