]> err.no Git - linux-2.6/commitdiff
[CPUFREQ] Remove hotplug cpu crap
authorDave Jones <davej@redhat.com>
Tue, 6 Feb 2007 00:12:43 +0000 (16:12 -0800)
committerDave Jones <davej@redhat.com>
Sun, 11 Feb 2007 01:01:47 +0000 (20:01 -0500)
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>
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_conservative.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/cpufreq/cpufreq_stats.c
drivers/cpufreq/cpufreq_userspace.c

index a45cc89e387a3ee14ba2afcda2cb09ac5303b1f0..9bdcdbdcc0ad351a5a4a7e4f86f8febefc6936ef 100644 (file)
@@ -415,12 +415,10 @@ static ssize_t store_##file_name                                  \
        if (ret != 1)                                                   \
                return -EINVAL;                                         \
                                                                        \
-       lock_cpu_hotplug();                                             \
        mutex_lock(&policy->lock);                                      \
        ret = __cpufreq_set_policy(policy, &new_policy);                \
        policy->user_policy.object = policy->object;                    \
        mutex_unlock(&policy->lock);                                    \
-       unlock_cpu_hotplug();                                           \
                                                                        \
        return ret ? ret : count;                                       \
 }
@@ -479,8 +477,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
                                                &new_policy.governor))
                return -EINVAL;
 
-       lock_cpu_hotplug();
-
        /* Do not use cpufreq_set_policy here or the user_policy.max
           will be wrongly overridden */
        mutex_lock(&policy->lock);
@@ -490,8 +486,6 @@ static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
        policy->user_policy.governor = policy->governor;
        mutex_unlock(&policy->lock);
 
-       unlock_cpu_hotplug();
-
        if (ret)
                return ret;
        else
@@ -1278,7 +1272,6 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier);
  *********************************************************************/
 
 
-/* Must be called with lock_cpu_hotplug held */
 int __cpufreq_driver_target(struct cpufreq_policy *policy,
                            unsigned int target_freq,
                            unsigned int relation)
@@ -1304,13 +1297,11 @@ int cpufreq_driver_target(struct cpufreq_policy *policy,
        if (!policy)
                return -EINVAL;
 
-       lock_cpu_hotplug();
        mutex_lock(&policy->lock);
 
        ret = __cpufreq_driver_target(policy, target_freq, relation);
 
        mutex_unlock(&policy->lock);
-       unlock_cpu_hotplug();
 
        cpufreq_cpu_put(policy);
        return ret;
@@ -1338,7 +1329,6 @@ int cpufreq_driver_getavg(struct cpufreq_policy *policy)
 EXPORT_SYMBOL_GPL(cpufreq_driver_getavg);
 
 /*
- * Locking: Must be called with the lock_cpu_hotplug() lock held
  * when "event" is CPUFREQ_GOV_LIMITS
  */
 
@@ -1433,7 +1423,6 @@ EXPORT_SYMBOL(cpufreq_get_policy);
 /*
  * data   : current policy.
  * policy : policy to be set.
- * Locking: Must be called with the lock_cpu_hotplug() lock held
  */
 static int __cpufreq_set_policy(struct cpufreq_policy *data,
                                struct cpufreq_policy *policy)
@@ -1539,8 +1528,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
        if (!data)
                return -EINVAL;
 
-       lock_cpu_hotplug();
-
        /* lock this CPU */
        mutex_lock(&data->lock);
 
@@ -1552,7 +1539,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
 
        mutex_unlock(&data->lock);
 
-       unlock_cpu_hotplug();
        cpufreq_cpu_put(data);
 
        return ret;
@@ -1576,7 +1562,6 @@ int cpufreq_update_policy(unsigned int cpu)
        if (!data)
                return -ENODEV;
 
-       lock_cpu_hotplug();
        mutex_lock(&data->lock);
 
        dprintk("updating policy for CPU %u\n", cpu);
@@ -1603,7 +1588,6 @@ int cpufreq_update_policy(unsigned int cpu)
        ret = __cpufreq_set_policy(data, &policy);
 
        mutex_unlock(&data->lock);
-       unlock_cpu_hotplug();
        cpufreq_cpu_put(data);
        return ret;
 }
index eef0270c6f3ddf98b23b3495628a60894199ec10..787e8417c106fd2be524533631aec27620febba7 100644 (file)
@@ -430,14 +430,12 @@ static void dbs_check_cpu(int cpu)
 static void do_dbs_timer(struct work_struct *work)
 { 
        int i;
-       lock_cpu_hotplug();
        mutex_lock(&dbs_mutex);
        for_each_online_cpu(i)
                dbs_check_cpu(i);
        schedule_delayed_work(&dbs_work, 
                        usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
        mutex_unlock(&dbs_mutex);
-       unlock_cpu_hotplug();
 } 
 
 static inline void dbs_timer_init(void)
index f697449327c6fca54f856189801965861855f6a6..d52f9b42652153f5eacf5aa1fa18bd7c887ad8df 100644 (file)
@@ -440,9 +440,7 @@ static void do_dbs_timer(struct work_struct *work)
        dbs_info->sample_type = DBS_NORMAL_SAMPLE;
        if (!dbs_tuners_ins.powersave_bias ||
            sample_type == DBS_NORMAL_SAMPLE) {
-               lock_cpu_hotplug();
                dbs_check_cpu(dbs_info);
-               unlock_cpu_hotplug();
                if (dbs_info->freq_lo) {
                        /* Setup timer for SUB_SAMPLE */
                        dbs_info->sample_type = DBS_SUB_SAMPLE;
index 91ad342a6051f19e64f5e00478cf2a5f8ab7e9a7..d1c7cac9316cc4e7729f8445c9ba8ebc07d858b7 100644 (file)
@@ -370,12 +370,10 @@ __exit cpufreq_stats_exit(void)
        cpufreq_unregister_notifier(&notifier_trans_block,
                        CPUFREQ_TRANSITION_NOTIFIER);
        unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier);
-       lock_cpu_hotplug();
        for_each_online_cpu(cpu) {
                cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier,
                                                CPU_DEAD, (void *)(long)cpu);
        }
-       unlock_cpu_hotplug();
 }
 
 MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>");
index 2a4eb0bfaf30d2cd6698a2c72d9e67468e6d08b5..860345c7799ab1188c21945756ec6e696019b10e 100644 (file)
@@ -71,7 +71,6 @@ static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy)
 
        dprintk("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq);
 
-       lock_cpu_hotplug();
        mutex_lock(&userspace_mutex);
        if (!cpu_is_managed[policy->cpu])
                goto err;
@@ -94,7 +93,6 @@ static int cpufreq_set(unsigned int freq, struct cpufreq_policy *policy)
 
  err:
        mutex_unlock(&userspace_mutex);
-       unlock_cpu_hotplug();
        return ret;
 }