[CPUFREQ] core: CPUFREQ_GOV_STOP needs to be last Assert that the call to the cpufreq governor with CPUFREQ_GOV_STOP is really the last. Without this patch, some strange in-kernel preemption combined with the scheduler disliking the "removing" task may cause the opposite. Signed-off-by: Dominik Brodowski --- drivers/cpufreq/cpufreq.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: 2.6.10/drivers/cpufreq/cpufreq.c =================================================================== --- 2.6.10.orig/drivers/cpufreq/cpufreq.c 2004-12-25 17:42:22.417410548 +0100 +++ 2.6.10/drivers/cpufreq/cpufreq.c 2004-12-25 17:42:31.174162692 +0100 @@ -763,8 +763,11 @@ spin_unlock_irqrestore(&cpufreq_driver_lock, flags); #endif + down(&data->lock); if (cpufreq_driver->target) __cpufreq_governor(data, CPUFREQ_GOV_STOP); + cpufreq_driver->target = NULL; + up(&data->lock); kobject_unregister(&data->kobj); @@ -1025,7 +1028,7 @@ lock_cpu_hotplug(); dprintk("target for CPU %u: %u kHz, relation %u\n", policy->cpu, target_freq, relation); - if (cpu_online(policy->cpu)) + if (cpu_online(policy->cpu) && cpufreq_driver->target) retval = cpufreq_driver->target(policy, target_freq, relation); unlock_cpu_hotplug(); return retval;