Skip to content

Commit 6f70168

Browse files
mwilczyrafaeljw
authored andcommitted
ACPI: video: Install Notify() handler directly
Modify the ACPI video driver to install its own Notify() handler directly instead of providing an ACPI driver .notify() callback. This will allow the ACPI driver .notify() callback to be eliminated and it will allow the ideo driver to be switched over to a platform one in the future. Suggested-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> [ rjw: Subject and changelog edits, whitespace adjustments ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 543a2d1 commit 6f70168

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

drivers/acpi/acpi_video.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static DEFINE_MUTEX(video_list_lock);
7777
static LIST_HEAD(video_bus_head);
7878
static int acpi_video_bus_add(struct acpi_device *device);
7979
static void acpi_video_bus_remove(struct acpi_device *device);
80-
static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
80+
static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data);
8181

8282
/*
8383
* Indices in the _BCL method response: the first two items are special,
@@ -104,7 +104,6 @@ static struct acpi_driver acpi_video_bus = {
104104
.ops = {
105105
.add = acpi_video_bus_add,
106106
.remove = acpi_video_bus_remove,
107-
.notify = acpi_video_bus_notify,
108107
},
109108
};
110109

@@ -1527,8 +1526,9 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
15271526
acpi_osi_is_win8() ? 0 : 1);
15281527
}
15291528

1530-
static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
1529+
static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
15311530
{
1531+
struct acpi_device *device = data;
15321532
struct acpi_video_bus *video = acpi_driver_data(device);
15331533
struct input_dev *input;
15341534
int keycode = 0;
@@ -2053,8 +2053,19 @@ static int acpi_video_bus_add(struct acpi_device *device)
20532053

20542054
acpi_video_bus_add_notify_handler(video);
20552055

2056+
error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
2057+
acpi_video_bus_notify);
2058+
if (error)
2059+
goto err_remove;
2060+
20562061
return 0;
20572062

2063+
err_remove:
2064+
mutex_lock(&video_list_lock);
2065+
list_del(&video->entry);
2066+
mutex_unlock(&video_list_lock);
2067+
acpi_video_bus_remove_notify_handler(video);
2068+
acpi_video_bus_unregister_backlight(video);
20582069
err_put_video:
20592070
acpi_video_bus_put_devices(video);
20602071
kfree(video->attached_array);
@@ -2075,6 +2086,9 @@ static void acpi_video_bus_remove(struct acpi_device *device)
20752086

20762087
video = acpi_driver_data(device);
20772088

2089+
acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
2090+
acpi_video_bus_notify);
2091+
20782092
mutex_lock(&video_list_lock);
20792093
list_del(&video->entry);
20802094
mutex_unlock(&video_list_lock);

0 commit comments

Comments
 (0)