Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ACPI: bus: Add context argument to acpi_dev_install_notify_handler()

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>

+9 -9
+1 -1
drivers/acpi/ac.c
··· 257 257 register_acpi_notifier(&ac->battery_nb); 258 258 259 259 result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY, 260 - acpi_ac_notify); 260 + acpi_ac_notify, device); 261 261 if (result) 262 262 goto err_unregister; 263 263
+1 -1
drivers/acpi/acpi_video.c
··· 2062 2062 goto err_del; 2063 2063 2064 2064 error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, 2065 - acpi_video_bus_notify); 2065 + acpi_video_bus_notify, device); 2066 2066 if (error) 2067 2067 goto err_remove; 2068 2068
+1 -1
drivers/acpi/battery.c
··· 1214 1214 device_init_wakeup(&device->dev, 1); 1215 1215 1216 1216 result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY, 1217 - acpi_battery_notify); 1217 + acpi_battery_notify, device); 1218 1218 if (result) 1219 1219 goto fail_pm; 1220 1220
+2 -2
drivers/acpi/bus.c
··· 556 556 557 557 int acpi_dev_install_notify_handler(struct acpi_device *adev, 558 558 u32 handler_type, 559 - acpi_notify_handler handler) 559 + acpi_notify_handler handler, void *context) 560 560 { 561 561 acpi_status status; 562 562 563 563 status = acpi_install_notify_handler(adev->handle, handler_type, 564 - handler, adev); 564 + handler, context); 565 565 if (ACPI_FAILURE(status)) 566 566 return -ENODEV; 567 567
+1 -1
drivers/acpi/hed.c
··· 57 57 hed_handle = device->handle; 58 58 59 59 err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, 60 - acpi_hed_notify); 60 + acpi_hed_notify, device); 61 61 if (err) 62 62 hed_handle = NULL; 63 63
+1 -1
drivers/acpi/nfit/core.c
··· 3391 3391 return rc; 3392 3392 3393 3393 rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY, 3394 - acpi_nfit_notify); 3394 + acpi_nfit_notify, adev); 3395 3395 if (rc) 3396 3396 return rc; 3397 3397
+1 -1
drivers/acpi/thermal.c
··· 956 956 acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature)); 957 957 958 958 result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY, 959 - acpi_thermal_notify); 959 + acpi_thermal_notify, device); 960 960 if (result) 961 961 goto flush_wq; 962 962
+1 -1
include/acpi/acpi_bus.h
··· 517 517 void acpi_bus_detach_private_data(acpi_handle); 518 518 int acpi_dev_install_notify_handler(struct acpi_device *adev, 519 519 u32 handler_type, 520 - acpi_notify_handler handler); 520 + acpi_notify_handler handler, void *context); 521 521 void acpi_dev_remove_notify_handler(struct acpi_device *adev, 522 522 u32 handler_type, 523 523 acpi_notify_handler handler);