]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/chrome: wilco_ec: event: Register ACPI notify handler
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 5 Mar 2026 19:43:59 +0000 (20:43 +0100)
committerTzung-Bi Shih <tzungbi@kernel.org>
Fri, 6 Mar 2026 04:35:07 +0000 (04:35 +0000)
To facilitate subsequent conversion of the driver to a platform one,
make it install an ACPI notify handler directly instead of using
a .notify() callback in struct acpi_driver.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/7931926.EvYhyI6sBW@rafael.j.wysocki
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
drivers/platform/chrome/wilco_ec/event.c

index 743cd4839bff6f0b8083c5bda818b2eb816f90eb..f4500dd05f933288bb0e1b93530b49f138834fd9 100644 (file)
@@ -253,14 +253,16 @@ static int enqueue_events(struct acpi_device *adev, const u8 *buf, u32 length)
 
 /**
  * event_device_notify() - Callback when EC generates an event over ACPI.
- * @adev: The device that the event is coming from.
+ * @handle: ACPI handle of the device that the event is coming from.
  * @value: Value passed to Notify() in ACPI.
+ * @data: Notify handler data.
  *
  * This function will read the events from the device and enqueue them.
  */
-static void event_device_notify(struct acpi_device *adev, u32 value)
+static void event_device_notify(acpi_handle handle, u32 value, void *data)
 {
        struct acpi_buffer event_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       struct acpi_device *adev = data;
        union acpi_object *obj;
        acpi_status status;
 
@@ -489,8 +491,16 @@ static int event_device_add(struct acpi_device *adev)
        if (error)
                goto free_dev_data;
 
+       /* Install an ACPI notify handler. */
+       error = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
+                                               event_device_notify, adev);
+       if (error)
+               goto free_cdev;
+
        return 0;
 
+free_cdev:
+       cdev_device_del(&dev_data->cdev, &dev_data->dev);
 free_dev_data:
        hangup_device(dev_data);
 free_minor:
@@ -502,6 +512,8 @@ static void event_device_remove(struct acpi_device *adev)
 {
        struct event_device_data *dev_data = adev->driver_data;
 
+       acpi_dev_remove_notify_handler(adev, ACPI_DEVICE_NOTIFY,
+                                      event_device_notify);
        cdev_device_del(&dev_data->cdev, &dev_data->dev);
        ida_free(&event_ida, MINOR(dev_data->dev.devt));
        hangup_device(dev_data);
@@ -519,7 +531,6 @@ static struct acpi_driver event_driver = {
        .ids = event_acpi_ids,
        .ops = {
                .add = event_device_add,
-               .notify = event_device_notify,
                .remove = event_device_remove,
        },
 };