aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-07 11:37:16 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 16:26:58 -0400
commit700b6721cd1b891b67c2dcee046be12154a21fd6 (patch)
tree039361cd10127bc6ea10cb3ef09bf61b84023016 /drivers/platform/x86
parent7015558fca5ee82fc17227b61d88ddaa02d82242 (diff)
fujitsu-laptop: 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. Tested by Tony on Fujitsu-Siemens Lifebook S6420 [FJNB1E6] with BIOS 1.18 (01/09/2009). Tested by Jonathan on Fujitsu S7020. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Acked-By: Tony Vroon <tony@linx.net> Tested-By: Tony Vroon <tony@linx.net> Acked-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au> Tested-by: Jonathan Woithe <jwoithe@physics.adelaide.edu.au> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 45940f31fe9e..10f879648f25 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -203,7 +203,7 @@ struct led_classdev kblamps_led = {
203static u32 dbg_level = 0x03; 203static u32 dbg_level = 0x03;
204#endif 204#endif
205 205
206static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); 206static void acpi_fujitsu_notify(struct acpi_device *device, u32 event);
207 207
208/* Fujitsu ACPI interface function */ 208/* Fujitsu ACPI interface function */
209 209
@@ -658,7 +658,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = {
658 658
659static int acpi_fujitsu_add(struct acpi_device *device) 659static int acpi_fujitsu_add(struct acpi_device *device)
660{ 660{
661 acpi_status status;
662 acpi_handle handle; 661 acpi_handle handle;
663 int result = 0; 662 int result = 0;
664 int state = 0; 663 int state = 0;
@@ -673,20 +672,10 @@ static int acpi_fujitsu_add(struct acpi_device *device)
673 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); 672 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
674 device->driver_data = fujitsu; 673 device->driver_data = fujitsu;
675 674
676 status = acpi_install_notify_handler(device->handle,
677 ACPI_DEVICE_NOTIFY,
678 acpi_fujitsu_notify, fujitsu);
679
680 if (ACPI_FAILURE(status)) {
681 printk(KERN_ERR "Error installing notify handler\n");
682 error = -ENODEV;
683 goto err_stop;
684 }
685
686 fujitsu->input = input = input_allocate_device(); 675 fujitsu->input = input = input_allocate_device();
687 if (!input) { 676 if (!input) {
688 error = -ENOMEM; 677 error = -ENOMEM;
689 goto err_uninstall_notify; 678 goto err_stop;
690 } 679 }
691 680
692 snprintf(fujitsu->phys, sizeof(fujitsu->phys), 681 snprintf(fujitsu->phys, sizeof(fujitsu->phys),
@@ -743,9 +732,6 @@ static int acpi_fujitsu_add(struct acpi_device *device)
743end: 732end:
744err_free_input_dev: 733err_free_input_dev:
745 input_free_device(input); 734 input_free_device(input);
746err_uninstall_notify:
747 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
748 acpi_fujitsu_notify);
749err_stop: 735err_stop:
750 736
751 return result; 737 return result;
@@ -753,7 +739,6 @@ err_stop:
753 739
754static int acpi_fujitsu_remove(struct acpi_device *device, int type) 740static int acpi_fujitsu_remove(struct acpi_device *device, int type)
755{ 741{
756 acpi_status status;
757 struct fujitsu_t *fujitsu = NULL; 742 struct fujitsu_t *fujitsu = NULL;
758 743
759 if (!device || !acpi_driver_data(device)) 744 if (!device || !acpi_driver_data(device))
@@ -761,10 +746,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)
761 746
762 fujitsu = acpi_driver_data(device); 747 fujitsu = acpi_driver_data(device);
763 748
764 status = acpi_remove_notify_handler(fujitsu->acpi_handle,
765 ACPI_DEVICE_NOTIFY,
766 acpi_fujitsu_notify);
767
768 if (!device || !acpi_driver_data(device)) 749 if (!device || !acpi_driver_data(device))
769 return -EINVAL; 750 return -EINVAL;
770 751
@@ -775,7 +756,7 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)
775 756
776/* Brightness notify */ 757/* Brightness notify */
777 758
778static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) 759static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
779{ 760{
780 struct input_dev *input; 761 struct input_dev *input;
781 int keycode; 762 int keycode;
@@ -829,8 +810,6 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data)
829 input_report_key(input, keycode, 0); 810 input_report_key(input, keycode, 0);
830 input_sync(input); 811 input_sync(input);
831 } 812 }
832
833 return;
834} 813}
835 814
836/* ACPI device for hotkey handling */ 815/* ACPI device for hotkey handling */
@@ -1107,6 +1086,7 @@ static struct acpi_driver acpi_fujitsu_driver = {
1107 .ops = { 1086 .ops = {
1108 .add = acpi_fujitsu_add, 1087 .add = acpi_fujitsu_add,
1109 .remove = acpi_fujitsu_remove, 1088 .remove = acpi_fujitsu_remove,
1089 .notify = acpi_fujitsu_notify,
1110 }, 1090 },
1111}; 1091};
1112 1092