aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-03-30 13:48:24 -0400
committerLen Brown <len.brown@intel.com>2009-04-05 02:25:07 -0400
commit7ec0a7290797f57b780f792d12f4bcc19c83aa4f (patch)
tree30826d0452f43040f938f85fcd0e10f507df7a2f
parent373cfc360ec773be2f7615e59a19f3313255db7c (diff)
ACPI: processor: use .notify method instead of installing handler directly
This patch adds a .notify() method. The presence of .notify() causes Linux/ACPI to manage event handlers and notify handlers on our behalf, so we don't have to install and remove them ourselves. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> CC: Zhang Rui <rui.zhang@intel.com> CC: Zhao Yakui <yakui.zhao@intel.com> CC: Venki Pallipadi <venkatesh.pallipadi@intel.com> CC: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/processor_core.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 8e683f8cc573..45ad3288c5ff 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -82,7 +82,7 @@ static int acpi_processor_add(struct acpi_device *device);
82static int acpi_processor_start(struct acpi_device *device); 82static int acpi_processor_start(struct acpi_device *device);
83static int acpi_processor_remove(struct acpi_device *device, int type); 83static int acpi_processor_remove(struct acpi_device *device, int type);
84static int acpi_processor_info_open_fs(struct inode *inode, struct file *file); 84static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
85static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); 85static void acpi_processor_notify(struct acpi_device *device, u32 event);
86static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 86static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu);
87static int acpi_processor_handle_eject(struct acpi_processor *pr); 87static int acpi_processor_handle_eject(struct acpi_processor *pr);
88 88
@@ -104,6 +104,7 @@ static struct acpi_driver acpi_processor_driver = {
104 .start = acpi_processor_start, 104 .start = acpi_processor_start,
105 .suspend = acpi_processor_suspend, 105 .suspend = acpi_processor_suspend,
106 .resume = acpi_processor_resume, 106 .resume = acpi_processor_resume,
107 .notify = acpi_processor_notify,
107 }, 108 },
108}; 109};
109 110
@@ -691,7 +692,6 @@ static DEFINE_PER_CPU(void *, processor_device_array);
691static int __cpuinit acpi_processor_start(struct acpi_device *device) 692static int __cpuinit acpi_processor_start(struct acpi_device *device)
692{ 693{
693 int result = 0; 694 int result = 0;
694 acpi_status status = AE_OK;
695 struct acpi_processor *pr; 695 struct acpi_processor *pr;
696 struct sys_device *sysdev; 696 struct sys_device *sysdev;
697 697
@@ -728,9 +728,6 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
728 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) 728 if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev"))
729 return -EFAULT; 729 return -EFAULT;
730 730
731 status = acpi_install_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
732 acpi_processor_notify, pr);
733
734 /* _PDC call should be done before doing anything else (if reqd.). */ 731 /* _PDC call should be done before doing anything else (if reqd.). */
735 arch_acpi_processor_init_pdc(pr); 732 arch_acpi_processor_init_pdc(pr);
736 acpi_processor_set_pdc(pr); 733 acpi_processor_set_pdc(pr);
@@ -776,18 +773,14 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
776 return result; 773 return result;
777} 774}
778 775
779static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) 776static void acpi_processor_notify(struct acpi_device *device, u32 event)
780{ 777{
781 struct acpi_processor *pr = data; 778 struct acpi_processor *pr = acpi_driver_data(device);
782 struct acpi_device *device = NULL;
783 int saved; 779 int saved;
784 780
785 if (!pr) 781 if (!pr)
786 return; 782 return;
787 783
788 if (acpi_bus_get_device(pr->handle, &device))
789 return;
790
791 switch (event) { 784 switch (event) {
792 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: 785 case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
793 saved = pr->performance_platform_limit; 786 saved = pr->performance_platform_limit;
@@ -866,7 +859,6 @@ static int acpi_processor_add(struct acpi_device *device)
866 859
867static int acpi_processor_remove(struct acpi_device *device, int type) 860static int acpi_processor_remove(struct acpi_device *device, int type)
868{ 861{
869 acpi_status status = AE_OK;
870 struct acpi_processor *pr = NULL; 862 struct acpi_processor *pr = NULL;
871 863
872 864
@@ -885,9 +877,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type)
885 877
886 acpi_processor_power_exit(pr, device); 878 acpi_processor_power_exit(pr, device);
887 879
888 status = acpi_remove_notify_handler(pr->handle, ACPI_DEVICE_NOTIFY,
889 acpi_processor_notify);
890
891 sysfs_remove_link(&device->dev.kobj, "sysdev"); 880 sysfs_remove_link(&device->dev.kobj, "sysdev");
892 881
893 acpi_processor_remove_fs(device); 882 acpi_processor_remove_fs(device);