]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: bus: Add context argument to acpi_dev_install_notify_handler()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 6 Oct 2023 15:32:51 +0000 (17:32 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 6 Oct 2023 15:32:51 +0000 (17:32 +0200)
Add void *context arrgument to the list of arguments of
acpi_dev_install_notify_handler() and modify it to pass that argument
as context to acpi_install_notify_handler() instead of its first
argument which is problematic in general (for example, if platform
drivers used it, they would rather get struct platform_device pointers
or pointers to their private data from the context arguments of their
notify handlers).

Make all of the current callers of acpi_dev_install_notify_handler()
take this change into account so as to avoid altering the general
functionality.

Co-developed-by: Michal Wilczynski <michal.wilczynski@intel.com>
Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/ac.c
drivers/acpi/acpi_video.c
drivers/acpi/battery.c
drivers/acpi/bus.c
drivers/acpi/hed.c
drivers/acpi/nfit/core.c
drivers/acpi/thermal.c
include/acpi/acpi_bus.h

index 225dc6818751ef598a9ad293a44bef15ffef5a0c..aac3e561790cde36850421f2fa44d0e5d7c7cb88 100644 (file)
@@ -257,7 +257,7 @@ static int acpi_ac_add(struct acpi_device *device)
        register_acpi_notifier(&ac->battery_nb);
 
        result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY,
-                                                acpi_ac_notify);
+                                                acpi_ac_notify, device);
        if (result)
                goto err_unregister;
 
index b411948594ff89ad2a9904a8681b02476a4bd13d..0b7a01f38b65cc15bd2f60535286f362564ba4fd 100644 (file)
@@ -2062,7 +2062,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
                goto err_del;
 
        error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
-                                               acpi_video_bus_notify);
+                                               acpi_video_bus_notify, device);
        if (error)
                goto err_remove;
 
index 969bf81e8d546a76ad9be2151db8b5ffab4ae137..b379401ff1c2032ea41e6e870ca97c19d49db9f1 100644 (file)
@@ -1214,7 +1214,7 @@ static int acpi_battery_add(struct acpi_device *device)
        device_init_wakeup(&device->dev, 1);
 
        result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY,
-                                                acpi_battery_notify);
+                                                acpi_battery_notify, device);
        if (result)
                goto fail_pm;
 
index f41dda2d34933661ea2908e4b94b1663058d583a..88811d813a476cd9f843c0da0a2a3bd40152b0ef 100644 (file)
@@ -556,12 +556,12 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device,
 
 int acpi_dev_install_notify_handler(struct acpi_device *adev,
                                    u32 handler_type,
-                                   acpi_notify_handler handler)
+                                   acpi_notify_handler handler, void *context)
 {
        acpi_status status;
 
        status = acpi_install_notify_handler(adev->handle, handler_type,
-                                            handler, adev);
+                                            handler, context);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
index 46c6f8c35b4368bd41405695c38d807b3827a11d..7652515a6be1e33728b8cb3751b7457b2124d1d4 100644 (file)
@@ -57,7 +57,7 @@ static int acpi_hed_add(struct acpi_device *device)
        hed_handle = device->handle;
 
        err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
-                                             acpi_hed_notify);
+                                             acpi_hed_notify, device);
        if (err)
                hed_handle = NULL;
 
index f0e6738ae3c94146a3878f833f0406f3fedf44a0..942b84d94078ac489e3850fc6cc2e6e966b466af 100644 (file)
@@ -3391,7 +3391,7 @@ static int acpi_nfit_add(struct acpi_device *adev)
                return rc;
 
        rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
-                                            acpi_nfit_notify);
+                                            acpi_nfit_notify, adev);
        if (rc)
                return rc;
 
index 312730f8272eeca4edc6d6695469b25497e57e15..609bc38f75ba711df29c7fa46d386f63cfe00154 100644 (file)
@@ -956,7 +956,7 @@ static int acpi_thermal_add(struct acpi_device *device)
                acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature));
 
        result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
-                                                acpi_thermal_notify);
+                                                acpi_thermal_notify, device);
        if (result)
                goto flush_wq;
 
index 254685085c825c84fecd23e81a3c420056b66ffd..e49a143ac0608d58d7f13a02a6e5c6bd8eadb445 100644 (file)
@@ -517,7 +517,7 @@ int acpi_bus_attach_private_data(acpi_handle, void *);
 void acpi_bus_detach_private_data(acpi_handle);
 int acpi_dev_install_notify_handler(struct acpi_device *adev,
                                    u32 handler_type,
-                                   acpi_notify_handler handler);
+                                   acpi_notify_handler handler, void *context);
 void acpi_dev_remove_notify_handler(struct acpi_device *adev,
                                    u32 handler_type,
                                    acpi_notify_handler handler);