aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-04-30 11:35:53 -0400
committerLen Brown <len.brown@intel.com>2009-06-18 00:13:15 -0400
commit586ed1604fd6137cae1e8ede8143c3b8897306fd (patch)
tree0a701eea65ecd372fa1d38cd4edb1b899fe36958 /drivers/platform
parentd94066910943837558d2a461c6766da981260bf0 (diff)
ACPI: asus-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. This driver apparently relies on seeing ALL notify events, not just device-specific ones (because it used ACPI_ALL_NOTIFY). We use the ACPI_DRIVER_ALL_NOTIFY_EVENTS driver flag to request all events. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> CC: Corentin Chary <corentincj@iksaif.net> CC: acpi4asus-user@lists.sourceforge.net Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/asus-laptop.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
index bfc1a8892a32..eaffe732653a 100644
--- a/drivers/platform/x86/asus-laptop.c
+++ b/drivers/platform/x86/asus-laptop.c
@@ -207,13 +207,17 @@ MODULE_DEVICE_TABLE(acpi, asus_device_ids);
207 207
208static int asus_hotk_add(struct acpi_device *device); 208static int asus_hotk_add(struct acpi_device *device);
209static int asus_hotk_remove(struct acpi_device *device, int type); 209static int asus_hotk_remove(struct acpi_device *device, int type);
210static void asus_hotk_notify(struct acpi_device *device, u32 event);
211
210static struct acpi_driver asus_hotk_driver = { 212static struct acpi_driver asus_hotk_driver = {
211 .name = ASUS_HOTK_NAME, 213 .name = ASUS_HOTK_NAME,
212 .class = ASUS_HOTK_CLASS, 214 .class = ASUS_HOTK_CLASS,
213 .ids = asus_device_ids, 215 .ids = asus_device_ids,
216 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
214 .ops = { 217 .ops = {
215 .add = asus_hotk_add, 218 .add = asus_hotk_add,
216 .remove = asus_hotk_remove, 219 .remove = asus_hotk_remove,
220 .notify = asus_hotk_notify,
217 }, 221 },
218}; 222};
219 223
@@ -812,7 +816,7 @@ static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode)
812 return -EINVAL; 816 return -EINVAL;
813} 817}
814 818
815static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 819static void asus_hotk_notify(struct acpi_device *device, u32 event)
816{ 820{
817 static struct key_entry *key; 821 static struct key_entry *key;
818 u16 count; 822 u16 count;
@@ -1124,7 +1128,6 @@ static int asus_hotk_found;
1124 1128
1125static int asus_hotk_add(struct acpi_device *device) 1129static int asus_hotk_add(struct acpi_device *device)
1126{ 1130{
1127 acpi_status status = AE_OK;
1128 int result; 1131 int result;
1129 1132
1130 if (!device) 1133 if (!device)
@@ -1149,15 +1152,6 @@ static int asus_hotk_add(struct acpi_device *device)
1149 1152
1150 asus_hotk_add_fs(); 1153 asus_hotk_add_fs();
1151 1154
1152 /*
1153 * We install the handler, it will receive the hotk in parameter, so, we
1154 * could add other data to the hotk struct
1155 */
1156 status = acpi_install_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
1157 asus_hotk_notify, hotk);
1158 if (ACPI_FAILURE(status))
1159 printk(ASUS_ERR "Error installing notify handler\n");
1160
1161 asus_hotk_found = 1; 1155 asus_hotk_found = 1;
1162 1156
1163 /* WLED and BLED are on by default */ 1157 /* WLED and BLED are on by default */
@@ -1198,16 +1192,9 @@ end:
1198 1192
1199static int asus_hotk_remove(struct acpi_device *device, int type) 1193static int asus_hotk_remove(struct acpi_device *device, int type)
1200{ 1194{
1201 acpi_status status = 0;
1202
1203 if (!device || !acpi_driver_data(device)) 1195 if (!device || !acpi_driver_data(device))
1204 return -EINVAL; 1196 return -EINVAL;
1205 1197
1206 status = acpi_remove_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
1207 asus_hotk_notify);
1208 if (ACPI_FAILURE(status))
1209 printk(ASUS_ERR "Error removing notify handler\n");
1210
1211 kfree(hotk->name); 1198 kfree(hotk->name);
1212 kfree(hotk); 1199 kfree(hotk);
1213 1200