diff options
Diffstat (limited to 'arch/i386/kernel/cpu/cpufreq/powernow-k8.c')
-rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index e5bc06480ff9..712a26bd4457 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -40,6 +40,7 @@ | |||
40 | 40 | ||
41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI | 41 | #ifdef CONFIG_X86_POWERNOW_K8_ACPI |
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | #include <linux/mutex.h> | ||
43 | #include <acpi/processor.h> | 44 | #include <acpi/processor.h> |
44 | #endif | 45 | #endif |
45 | 46 | ||
@@ -49,7 +50,7 @@ | |||
49 | #include "powernow-k8.h" | 50 | #include "powernow-k8.h" |
50 | 51 | ||
51 | /* serialize freq changes */ | 52 | /* serialize freq changes */ |
52 | static DECLARE_MUTEX(fidvid_sem); | 53 | static DEFINE_MUTEX(fidvid_mutex); |
53 | 54 | ||
54 | static struct powernow_k8_data *powernow_data[NR_CPUS]; | 55 | static struct powernow_k8_data *powernow_data[NR_CPUS]; |
55 | 56 | ||
@@ -943,17 +944,17 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
943 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) | 944 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) |
944 | goto err_out; | 945 | goto err_out; |
945 | 946 | ||
946 | down(&fidvid_sem); | 947 | mutex_lock(&fidvid_mutex); |
947 | 948 | ||
948 | powernow_k8_acpi_pst_values(data, newstate); | 949 | powernow_k8_acpi_pst_values(data, newstate); |
949 | 950 | ||
950 | if (transition_frequency(data, newstate)) { | 951 | if (transition_frequency(data, newstate)) { |
951 | printk(KERN_ERR PFX "transition frequency failed\n"); | 952 | printk(KERN_ERR PFX "transition frequency failed\n"); |
952 | ret = 1; | 953 | ret = 1; |
953 | up(&fidvid_sem); | 954 | mutex_unlock(&fidvid_mutex); |
954 | goto err_out; | 955 | goto err_out; |
955 | } | 956 | } |
956 | up(&fidvid_sem); | 957 | mutex_unlock(&fidvid_mutex); |
957 | 958 | ||
958 | pol->cur = find_khz_freq_from_fid(data->currfid); | 959 | pol->cur = find_khz_freq_from_fid(data->currfid); |
959 | ret = 0; | 960 | ret = 0; |
@@ -1094,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol) | |||
1094 | 1095 | ||
1095 | static unsigned int powernowk8_get (unsigned int cpu) | 1096 | static unsigned int powernowk8_get (unsigned int cpu) |
1096 | { | 1097 | { |
1097 | struct powernow_k8_data *data = powernow_data[cpu]; | 1098 | struct powernow_k8_data *data; |
1098 | cpumask_t oldmask = current->cpus_allowed; | 1099 | cpumask_t oldmask = current->cpus_allowed; |
1099 | unsigned int khz = 0; | 1100 | unsigned int khz = 0; |
1100 | 1101 | ||
1102 | data = powernow_data[first_cpu(cpu_core_map[cpu])]; | ||
1103 | |||
1104 | if (!data) | ||
1105 | return -EINVAL; | ||
1106 | |||
1101 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | 1107 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); |
1102 | if (smp_processor_id() != cpu) { | 1108 | if (smp_processor_id() != cpu) { |
1103 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); | 1109 | printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); |