]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
platform/x86: topstar-laptop: Register ACPI notify handler directly
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 12 Mar 2026 14:32:36 +0000 (15:32 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 17 Mar 2026 17:50:08 +0000 (19:50 +0200)
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://patch.msgid.link/3425557.44csPzL39Z@rafael.j.wysocki
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/topstar-laptop.c

index a7b4b6c8e549265848b4ff094776a8a9b7380e6c..695ec1d25bcd0bd3f5e3cc4613f6523b4e81e316 100644 (file)
@@ -232,9 +232,9 @@ static int topstar_acpi_fncx_switch(struct acpi_device *device, bool state)
        return 0;
 }
 
-static void topstar_acpi_notify(struct acpi_device *device, u32 event)
+static void topstar_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct topstar_laptop *topstar = acpi_driver_data(device);
+       struct topstar_laptop *topstar = data;
        static bool dup_evnt[2];
        bool *dup;
 
@@ -313,14 +313,21 @@ static int topstar_acpi_add(struct acpi_device *device)
        if (err)
                goto err_platform_exit;
 
+       err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+                                             topstar_acpi_notify, topstar);
+       if (err)
+               goto err_input_exit;
+
        if (led_workaround) {
                err = topstar_led_init(topstar);
                if (err)
-                       goto err_input_exit;
+                       goto err_notify_handler_exit;
        }
 
        return 0;
 
+err_notify_handler_exit:
+       acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, topstar_acpi_notify);
 err_input_exit:
        topstar_input_exit(topstar);
 err_platform_exit:
@@ -339,6 +346,7 @@ static void topstar_acpi_remove(struct acpi_device *device)
        if (led_workaround)
                topstar_led_exit(topstar);
 
+       acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY, topstar_acpi_notify);
        topstar_input_exit(topstar);
        topstar_platform_exit(topstar);
        topstar_acpi_exit(topstar);
@@ -360,7 +368,6 @@ static struct acpi_driver topstar_acpi_driver = {
        .ops = {
                .add = topstar_acpi_add,
                .remove = topstar_acpi_remove,
-               .notify = topstar_acpi_notify,
        },
 };