]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86: toshiba_acpi: Register ACPI notify handler directly
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 24 Mar 2026 19:58:48 +0000 (20:58 +0100)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 31 Mar 2026 16:14:26 +0000 (19:14 +0300)
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/5070377.GXAFRqVoOG@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/toshiba_acpi.c

index fbd7b6b6b826b821d59d86a6845039ab8890d044..b839f62ec9cc06e0a147afe26aa89b94d96b02a8 100644 (file)
@@ -223,6 +223,7 @@ struct toshiba_acpi_dev {
        unsigned int cooling_method_supported:1;
        unsigned int battery_charge_mode_supported:1;
        unsigned int sysfs_created:1;
+       unsigned int notify_handler_installed:1;
        unsigned int special_functions;
 
        bool kbd_event_generated;
@@ -3193,9 +3194,10 @@ static void print_supported_features(struct toshiba_acpi_dev *dev)
        pr_cont("\n");
 }
 
-static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event)
+static void toshiba_acpi_notify(acpi_handle handle, u32 event, void *data)
 {
-       struct toshiba_acpi_dev *dev = acpi_driver_data(acpi_dev);
+       struct toshiba_acpi_dev *dev = data;
+       struct acpi_device *acpi_dev = dev->acpi_dev;
 
        switch (event) {
        case 0x80: /* Hotkeys and some system events */
@@ -3261,6 +3263,10 @@ static void toshiba_acpi_remove(struct acpi_device *acpi_dev)
 
        remove_toshiba_proc_entries(dev);
 
+       if (dev->notify_handler_installed)
+               acpi_dev_remove_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY,
+                                              toshiba_acpi_notify);
+
 #if IS_ENABLED(CONFIG_HWMON)
        if (dev->hwmon_device)
                hwmon_device_unregister(dev->hwmon_device);
@@ -3537,6 +3543,13 @@ iio_error:
        }
        dev->sysfs_created = !ret;
 
+       ret = acpi_dev_install_notify_handler(acpi_dev, ACPI_DEVICE_NOTIFY,
+                                             toshiba_acpi_notify, dev);
+       if (ret)
+               goto error;
+
+       dev->notify_handler_installed = 1;
+
        create_toshiba_proc_entries(dev);
 
        toshiba_acpi = dev;
@@ -3602,7 +3615,6 @@ static struct acpi_driver toshiba_acpi_driver = {
        .ops    = {
                .add            = toshiba_acpi_add,
                .remove         = toshiba_acpi_remove,
-               .notify         = toshiba_acpi_notify,
        },
        .drv.pm = &toshiba_acpi_pm,
 };