Skip to content

Commit 470508f

Browse files
committed
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 <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5f3c10a commit 470508f

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

drivers/acpi/ac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ static int acpi_ac_add(struct acpi_device *device)
257257
register_acpi_notifier(&ac->battery_nb);
258258

259259
result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY,
260-
acpi_ac_notify);
260+
acpi_ac_notify, device);
261261
if (result)
262262
goto err_unregister;
263263

drivers/acpi/acpi_video.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2062,7 +2062,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
20622062
goto err_del;
20632063

20642064
error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
2065-
acpi_video_bus_notify);
2065+
acpi_video_bus_notify, device);
20662066
if (error)
20672067
goto err_remove;
20682068

drivers/acpi/battery.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ static int acpi_battery_add(struct acpi_device *device)
12141214
device_init_wakeup(&device->dev, 1);
12151215

12161216
result = acpi_dev_install_notify_handler(device, ACPI_ALL_NOTIFY,
1217-
acpi_battery_notify);
1217+
acpi_battery_notify, device);
12181218
if (result)
12191219
goto fail_pm;
12201220

drivers/acpi/bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,12 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device,
556556

557557
int acpi_dev_install_notify_handler(struct acpi_device *adev,
558558
u32 handler_type,
559-
acpi_notify_handler handler)
559+
acpi_notify_handler handler, void *context)
560560
{
561561
acpi_status status;
562562

563563
status = acpi_install_notify_handler(adev->handle, handler_type,
564-
handler, adev);
564+
handler, context);
565565
if (ACPI_FAILURE(status))
566566
return -ENODEV;
567567

drivers/acpi/hed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int acpi_hed_add(struct acpi_device *device)
5757
hed_handle = device->handle;
5858

5959
err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
60-
acpi_hed_notify);
60+
acpi_hed_notify, device);
6161
if (err)
6262
hed_handle = NULL;
6363

drivers/acpi/nfit/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3391,7 +3391,7 @@ static int acpi_nfit_add(struct acpi_device *adev)
33913391
return rc;
33923392

33933393
rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
3394-
acpi_nfit_notify);
3394+
acpi_nfit_notify, adev);
33953395
if (rc)
33963396
return rc;
33973397

drivers/acpi/thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ static int acpi_thermal_add(struct acpi_device *device)
956956
acpi_device_bid(device), deci_kelvin_to_celsius(tz->temperature));
957957

958958
result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
959-
acpi_thermal_notify);
959+
acpi_thermal_notify, device);
960960
if (result)
961961
goto flush_wq;
962962

include/acpi/acpi_bus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ int acpi_bus_attach_private_data(acpi_handle, void *);
517517
void acpi_bus_detach_private_data(acpi_handle);
518518
int acpi_dev_install_notify_handler(struct acpi_device *adev,
519519
u32 handler_type,
520-
acpi_notify_handler handler);
520+
acpi_notify_handler handler, void *context);
521521
void acpi_dev_remove_notify_handler(struct acpi_device *adev,
522522
u32 handler_type,
523523
acpi_notify_handler handler);

0 commit comments

Comments
 (0)