hwmon: (w83791d) Use fan divisor bits from vbat register
[safe/jmp/linux-2.6] / drivers / acpi / processor_perflib.c
index b477a4b..0133af4 100644 (file)
@@ -64,7 +64,13 @@ static DEFINE_MUTEX(performance_mutex);
  * policy is adjusted accordingly.
  */
 
-static unsigned int ignore_ppc = 0;
+/* ignore_ppc:
+ * -1 -> cpufreq low level drivers not initialized -> _PSS, etc. not called yet
+ *       ignore _PPC
+ *  0 -> cpufreq low level drivers initialized -> consider _PPC values
+ *  1 -> ignore _PPC totally -> forced by user through boot param
+ */
+static unsigned int ignore_ppc = -1;
 module_param(ignore_ppc, uint, 0644);
 MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
                 "limited by BIOS, this should help");
@@ -72,7 +78,7 @@ MODULE_PARM_DESC(ignore_ppc, "If the frequency of your machine gets wrongly" \
 #define PPC_REGISTERED   1
 #define PPC_IN_USE       2
 
-static int acpi_processor_ppc_status = 0;
+static int acpi_processor_ppc_status;
 
 static int acpi_processor_ppc_notifier(struct notifier_block *nb,
                                       unsigned long event, void *data)
@@ -81,15 +87,20 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb,
        struct acpi_processor *pr;
        unsigned int ppc = 0;
 
-       if (ignore_ppc)
+       if (event == CPUFREQ_START && ignore_ppc <= 0) {
+               ignore_ppc = 0;
                return 0;
+       }
 
-       mutex_lock(&performance_mutex);
+       if (ignore_ppc)
+               return 0;
 
        if (event != CPUFREQ_INCOMPATIBLE)
-               goto out;
+               return 0;
 
-       pr = processors[policy->cpu];
+       mutex_lock(&performance_mutex);
+
+       pr = per_cpu(processors, policy->cpu);
        if (!pr || !pr->performance)
                goto out;
 
@@ -411,6 +422,7 @@ EXPORT_SYMBOL(acpi_processor_notify_smm);
 
 static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
 static struct file_operations acpi_processor_perf_fops = {
+       .owner = THIS_MODULE,
        .open = acpi_processor_perf_open_fs,
        .read = seq_read,
        .llseek = seq_lseek,
@@ -456,7 +468,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
 
 static void acpi_cpufreq_add_file(struct acpi_processor *pr)
 {
-       struct proc_dir_entry *entry = NULL;
        struct acpi_device *device = NULL;
 
 
@@ -464,14 +475,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr)
                return;
 
        /* add file 'performance' [R/W] */
-       entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
-                                 S_IFREG | S_IRUGO,
-                                 acpi_device_dir(device));
-       if (entry){
-               entry->proc_fops = &acpi_processor_perf_fops;
-               entry->data = acpi_driver_data(device);
-               entry->owner = THIS_MODULE;
-       }
+       proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO,
+                        acpi_device_dir(device),
+                        &acpi_processor_perf_fops, acpi_driver_data(device));
        return;
 }
 
@@ -577,7 +583,7 @@ int acpi_processor_preregister_performance(
 
        /* Call _PSD for all CPUs */
        for_each_possible_cpu(i) {
-               pr = processors[i];
+               pr = per_cpu(processors, i);
                if (!pr) {
                        /* Look only at processors in ACPI namespace */
                        continue;
@@ -608,7 +614,7 @@ int acpi_processor_preregister_performance(
         * domain info.
         */
        for_each_possible_cpu(i) {
-               pr = processors[i];
+               pr = per_cpu(processors, i);
                if (!pr)
                        continue;
 
@@ -629,7 +635,7 @@ int acpi_processor_preregister_performance(
 
        cpus_clear(covered_cpus);
        for_each_possible_cpu(i) {
-               pr = processors[i];
+               pr = per_cpu(processors, i);
                if (!pr)
                        continue;
 
@@ -656,7 +662,7 @@ int acpi_processor_preregister_performance(
                        if (i == j)
                                continue;
 
-                       match_pr = processors[j];
+                       match_pr = per_cpu(processors, j);
                        if (!match_pr)
                                continue;
 
@@ -685,7 +691,7 @@ int acpi_processor_preregister_performance(
                        if (i == j)
                                continue;
 
-                       match_pr = processors[j];
+                       match_pr = per_cpu(processors, j);
                        if (!match_pr)
                                continue;
 
@@ -702,7 +708,7 @@ int acpi_processor_preregister_performance(
 
 err_ret:
        for_each_possible_cpu(i) {
-               pr = processors[i];
+               pr = per_cpu(processors, i);
                if (!pr || !pr->performance)
                        continue;
 
@@ -733,7 +739,7 @@ acpi_processor_register_performance(struct acpi_processor_performance
 
        mutex_lock(&performance_mutex);
 
-       pr = processors[cpu];
+       pr = per_cpu(processors, cpu);
        if (!pr) {
                mutex_unlock(&performance_mutex);
                return -ENODEV;
@@ -771,7 +777,7 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
 
        mutex_lock(&performance_mutex);
 
-       pr = processors[cpu];
+       pr = per_cpu(processors, cpu);
        if (!pr) {
                mutex_unlock(&performance_mutex);
                return;