aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/processor_driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/processor_driver.c')
-rw-r--r--drivers/acpi/processor_driver.c80
1 files changed, 6 insertions, 74 deletions
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 85e48047d7b0..360a74e6add0 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -40,10 +40,6 @@
40#include <linux/pm.h> 40#include <linux/pm.h>
41#include <linux/cpufreq.h> 41#include <linux/cpufreq.h>
42#include <linux/cpu.h> 42#include <linux/cpu.h>
43#ifdef CONFIG_ACPI_PROCFS
44#include <linux/proc_fs.h>
45#include <linux/seq_file.h>
46#endif
47#include <linux/dmi.h> 43#include <linux/dmi.h>
48#include <linux/moduleparam.h> 44#include <linux/moduleparam.h>
49#include <linux/cpuidle.h> 45#include <linux/cpuidle.h>
@@ -246,53 +242,6 @@ static int acpi_processor_errata(struct acpi_processor *pr)
246 return result; 242 return result;
247} 243}
248 244
249#ifdef CONFIG_ACPI_PROCFS
250static struct proc_dir_entry *acpi_processor_dir = NULL;
251
252static int __cpuinit acpi_processor_add_fs(struct acpi_device *device)
253{
254 struct proc_dir_entry *entry = NULL;
255
256
257 if (!acpi_device_dir(device)) {
258 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
259 acpi_processor_dir);
260 if (!acpi_device_dir(device))
261 return -ENODEV;
262 }
263
264 /* 'throttling' [R/W] */
265 entry = proc_create_data(ACPI_PROCESSOR_FILE_THROTTLING,
266 S_IFREG | S_IRUGO | S_IWUSR,
267 acpi_device_dir(device),
268 &acpi_processor_throttling_fops,
269 acpi_driver_data(device));
270 if (!entry)
271 return -EIO;
272 return 0;
273}
274static int acpi_processor_remove_fs(struct acpi_device *device)
275{
276
277 if (acpi_device_dir(device)) {
278 remove_proc_entry(ACPI_PROCESSOR_FILE_THROTTLING,
279 acpi_device_dir(device));
280 remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
281 acpi_device_dir(device) = NULL;
282 }
283
284 return 0;
285}
286#else
287static inline int acpi_processor_add_fs(struct acpi_device *device)
288{
289 return 0;
290}
291static inline int acpi_processor_remove_fs(struct acpi_device *device)
292{
293 return 0;
294}
295#endif
296/* -------------------------------------------------------------------------- 245/* --------------------------------------------------------------------------
297 Driver Interface 246 Driver Interface
298 -------------------------------------------------------------------------- */ 247 -------------------------------------------------------------------------- */
@@ -478,8 +427,13 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
478 if (action == CPU_ONLINE && pr) { 427 if (action == CPU_ONLINE && pr) {
479 acpi_processor_ppc_has_changed(pr, 0); 428 acpi_processor_ppc_has_changed(pr, 0);
480 acpi_processor_cst_has_changed(pr); 429 acpi_processor_cst_has_changed(pr);
430 acpi_processor_reevaluate_tstate(pr, action);
481 acpi_processor_tstate_has_changed(pr); 431 acpi_processor_tstate_has_changed(pr);
482 } 432 }
433 if (action == CPU_DEAD && pr) {
434 /* invalidate the flag.throttling after one CPU is offline */
435 acpi_processor_reevaluate_tstate(pr, action);
436 }
483 return NOTIFY_OK; 437 return NOTIFY_OK;
484} 438}
485 439
@@ -537,14 +491,10 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
537 491
538 per_cpu(processors, pr->id) = pr; 492 per_cpu(processors, pr->id) = pr;
539 493
540 result = acpi_processor_add_fs(device);
541 if (result)
542 goto err_free_cpumask;
543
544 sysdev = get_cpu_sysdev(pr->id); 494 sysdev = get_cpu_sysdev(pr->id);
545 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { 495 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) {
546 result = -EFAULT; 496 result = -EFAULT;
547 goto err_remove_fs; 497 goto err_free_cpumask;
548 } 498 }
549 499
550#ifdef CONFIG_CPU_FREQ 500#ifdef CONFIG_CPU_FREQ
@@ -590,8 +540,6 @@ err_thermal_unregister:
590 thermal_cooling_device_unregister(pr->cdev); 540 thermal_cooling_device_unregister(pr->cdev);
591err_power_exit: 541err_power_exit:
592 acpi_processor_power_exit(pr, device); 542 acpi_processor_power_exit(pr, device);
593err_remove_fs:
594 acpi_processor_remove_fs(device);
595err_free_cpumask: 543err_free_cpumask:
596 free_cpumask_var(pr->throttling.shared_cpu_map); 544 free_cpumask_var(pr->throttling.shared_cpu_map);
597 545
@@ -620,8 +568,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
620 568
621 sysfs_remove_link(&device->dev.kobj, "sysdev"); 569 sysfs_remove_link(&device->dev.kobj, "sysdev");
622 570
623 acpi_processor_remove_fs(device);
624
625 if (pr->cdev) { 571 if (pr->cdev) {
626 sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 572 sysfs_remove_link(&device->dev.kobj, "thermal_cooling");
627 sysfs_remove_link(&pr->cdev->device.kobj, "device"); 573 sysfs_remove_link(&pr->cdev->device.kobj, "device");
@@ -854,12 +800,6 @@ static int __init acpi_processor_init(void)
854 800
855 memset(&errata, 0, sizeof(errata)); 801 memset(&errata, 0, sizeof(errata));
856 802
857#ifdef CONFIG_ACPI_PROCFS
858 acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
859 if (!acpi_processor_dir)
860 return -ENOMEM;
861#endif
862
863 if (!cpuidle_register_driver(&acpi_idle_driver)) { 803 if (!cpuidle_register_driver(&acpi_idle_driver)) {
864 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n", 804 printk(KERN_DEBUG "ACPI: %s registered with cpuidle\n",
865 acpi_idle_driver.name); 805 acpi_idle_driver.name);
@@ -885,10 +825,6 @@ static int __init acpi_processor_init(void)
885out_cpuidle: 825out_cpuidle:
886 cpuidle_unregister_driver(&acpi_idle_driver); 826 cpuidle_unregister_driver(&acpi_idle_driver);
887 827
888#ifdef CONFIG_ACPI_PROCFS
889 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
890#endif
891
892 return result; 828 return result;
893} 829}
894 830
@@ -907,10 +843,6 @@ static void __exit acpi_processor_exit(void)
907 843
908 cpuidle_unregister_driver(&acpi_idle_driver); 844 cpuidle_unregister_driver(&acpi_idle_driver);
909 845
910#ifdef CONFIG_ACPI_PROCFS
911 remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
912#endif
913
914 return; 846 return;
915} 847}
916 848