@@ -1515,11 +1515,14 @@ static void asus_input_exit(struct asus_laptop *asus)
/*
* ACPI driver
*/
-static void asus_acpi_notify(struct acpi_device *device, u32 event)
+static void asus_acpi_notify(acpi_handle handle, u32 event, void *data)
{
- struct asus_laptop *asus = acpi_driver_data(device);
+ struct acpi_device *device = data;
+ struct asus_laptop *asus;
u16 count;
+ asus = acpi_driver_data(device);
+
/* TODO Find a better way to handle events count. */
count = asus->event_count[event % 128]++;
acpi_bus_generate_netlink_event(asus->device->pnp.device_class,
@@ -1880,6 +1883,10 @@ static int asus_acpi_add(struct acpi_device *device)
if (result && result != -ENODEV)
goto fail_pega_rfkill;
+ result = acpi_device_install_event_handler(device, ACPI_ALL_NOTIFY, asus_acpi_notify);
+ if (result)
+ goto fail_pega_rfkill;
+
asus_device_present = true;
return 0;
@@ -1905,6 +1912,7 @@ static void asus_acpi_remove(struct acpi_device *device)
{
struct asus_laptop *asus = acpi_driver_data(device);
+ acpi_device_remove_event_handler(device, ACPI_ALL_NOTIFY, asus_acpi_notify);
asus_backlight_exit(asus);
asus_rfkill_exit(asus);
asus_led_exit(asus);
@@ -1928,11 +1936,9 @@ static struct acpi_driver asus_acpi_driver = {
.class = ASUS_LAPTOP_CLASS,
.owner = THIS_MODULE,
.ids = asus_device_ids,
- .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = {
.add = asus_acpi_add,
.remove = asus_acpi_remove,
- .notify = asus_acpi_notify,
},
};
Currently logic for installing notifications from ACPI devices is implemented using notify callback in struct acpi_driver. Preparations are being made to replace acpi_driver with more generic struct platform_driver, which doesn't contain notify callback. Furthermore as of now handlers are being called indirectly through acpi_notify_device(), which decreases performance. Call acpi_device_install_event_handler() at the end of .add() callback. Call acpi_device_remove_event_handler() at the beginning of .remove() callback. Change arguments passed to the notify callback to match with what's required by acpi_device_install_event_handler(). Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> --- drivers/platform/x86/asus-laptop.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)