@@ -129,8 +129,10 @@ static const struct attribute_group haps_attr_group = {
/*
* ACPI stuff
*/
-static void toshiba_haps_notify(struct acpi_device *device, u32 event)
+static void toshiba_haps_notify(acpi_handle handle, u32 event, void *data)
{
+ struct acpi_device *device = data;
+
pr_debug("Received event: 0x%x\n", event);
acpi_bus_generate_netlink_event(device->pnp.device_class,
@@ -140,6 +142,7 @@ static void toshiba_haps_notify(struct acpi_device *device, u32 event)
static void toshiba_haps_remove(struct acpi_device *device)
{
+ acpi_device_remove_event_handler(acpi_dev, ACPI_ALL_NOTIFY, toshiba_haps_notify);
sysfs_remove_group(&device->dev.kobj, &haps_attr_group);
if (toshiba_haps)
@@ -203,7 +206,7 @@ static int toshiba_haps_add(struct acpi_device *acpi_dev)
toshiba_haps = haps;
- return 0;
+ return acpi_device_install_event_handler(acpi_dev, ACPI_ALL_NOTIFY, toshiba_haps_notify);
}
#ifdef CONFIG_PM_SLEEP
@@ -253,11 +256,9 @@ static struct acpi_driver toshiba_haps_driver = {
.name = "Toshiba HAPS",
.owner = THIS_MODULE,
.ids = haps_device_ids,
- .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = {
.add = toshiba_haps_add,
.remove = toshiba_haps_remove,
- .notify = toshiba_haps_notify,
},
.drv.pm = &toshiba_haps_pm,
};
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/toshiba_haps.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)