aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-07 11:37:22 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 16:26:58 -0400
commitb4ec0275464756f4fd4108b4a4ca7aff61358ad3 (patch)
treec9434e83a6bb1eea45ab24a4123c4a2a2aeeb21e /drivers/platform
parent700b6721cd1b891b67c2dcee046be12154a21fd6 (diff)
fujitsu-laptop: use .notify method instead of installing hotkey 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')
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 10f879648f25..218b9a16ac3f 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -174,8 +174,7 @@ struct fujitsu_hotkey_t {
174 174
175static struct fujitsu_hotkey_t *fujitsu_hotkey; 175static struct fujitsu_hotkey_t *fujitsu_hotkey;
176 176
177static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, 177static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
178 void *data);
179 178
180#ifdef CONFIG_LEDS_CLASS 179#ifdef CONFIG_LEDS_CLASS
181static enum led_brightness logolamp_get(struct led_classdev *cdev); 180static enum led_brightness logolamp_get(struct led_classdev *cdev);
@@ -816,7 +815,6 @@ static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
816 815
817static int acpi_fujitsu_hotkey_add(struct acpi_device *device) 816static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
818{ 817{
819 acpi_status status;
820 acpi_handle handle; 818 acpi_handle handle;
821 int result = 0; 819 int result = 0;
822 int state = 0; 820 int state = 0;
@@ -833,17 +831,6 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
833 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); 831 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
834 device->driver_data = fujitsu_hotkey; 832 device->driver_data = fujitsu_hotkey;
835 833
836 status = acpi_install_notify_handler(device->handle,
837 ACPI_DEVICE_NOTIFY,
838 acpi_fujitsu_hotkey_notify,
839 fujitsu_hotkey);
840
841 if (ACPI_FAILURE(status)) {
842 printk(KERN_ERR "Error installing notify handler\n");
843 error = -ENODEV;
844 goto err_stop;
845 }
846
847 /* kfifo */ 834 /* kfifo */
848 spin_lock_init(&fujitsu_hotkey->fifo_lock); 835 spin_lock_init(&fujitsu_hotkey->fifo_lock);
849 fujitsu_hotkey->fifo = 836 fujitsu_hotkey->fifo =
@@ -858,7 +845,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
858 fujitsu_hotkey->input = input = input_allocate_device(); 845 fujitsu_hotkey->input = input = input_allocate_device();
859 if (!input) { 846 if (!input) {
860 error = -ENOMEM; 847 error = -ENOMEM;
861 goto err_uninstall_notify; 848 goto err_free_fifo;
862 } 849 }
863 850
864 snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys), 851 snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
@@ -954,9 +941,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
954end: 941end:
955err_free_input_dev: 942err_free_input_dev:
956 input_free_device(input); 943 input_free_device(input);
957err_uninstall_notify: 944err_free_fifo:
958 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
959 acpi_fujitsu_hotkey_notify);
960 kfifo_free(fujitsu_hotkey->fifo); 945 kfifo_free(fujitsu_hotkey->fifo);
961err_stop: 946err_stop:
962 947
@@ -965,7 +950,6 @@ err_stop:
965 950
966static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) 951static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
967{ 952{
968 acpi_status status;
969 struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; 953 struct fujitsu_hotkey_t *fujitsu_hotkey = NULL;
970 954
971 if (!device || !acpi_driver_data(device)) 955 if (!device || !acpi_driver_data(device))
@@ -973,10 +957,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
973 957
974 fujitsu_hotkey = acpi_driver_data(device); 958 fujitsu_hotkey = acpi_driver_data(device);
975 959
976 status = acpi_remove_notify_handler(fujitsu_hotkey->acpi_handle,
977 ACPI_DEVICE_NOTIFY,
978 acpi_fujitsu_hotkey_notify);
979
980 fujitsu_hotkey->acpi_handle = NULL; 960 fujitsu_hotkey->acpi_handle = NULL;
981 961
982 kfifo_free(fujitsu_hotkey->fifo); 962 kfifo_free(fujitsu_hotkey->fifo);
@@ -984,8 +964,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
984 return 0; 964 return 0;
985} 965}
986 966
987static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, 967static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
988 void *data)
989{ 968{
990 struct input_dev *input; 969 struct input_dev *input;
991 int keycode, keycode_r; 970 int keycode, keycode_r;
@@ -1068,8 +1047,6 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
1068 input_sync(input); 1047 input_sync(input);
1069 break; 1048 break;
1070 } 1049 }
1071
1072 return;
1073} 1050}
1074 1051
1075/* Initialization */ 1052/* Initialization */
@@ -1102,6 +1079,7 @@ static struct acpi_driver acpi_fujitsu_hotkey_driver = {
1102 .ops = { 1079 .ops = {
1103 .add = acpi_fujitsu_hotkey_add, 1080 .add = acpi_fujitsu_hotkey_add,
1104 .remove = acpi_fujitsu_hotkey_remove, 1081 .remove = acpi_fujitsu_hotkey_remove,
1082 .notify = acpi_fujitsu_hotkey_notify,
1105 }, 1083 },
1106}; 1084};
1107 1085