Commit 6f701681 authored by Michal Wilczynski's avatar Michal Wilczynski Committed by Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarMichal Wilczynski <michal.wilczynski@intel.com>
[ rjw: Subject and changelog edits, whitespace adjustments ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 543a2d11
...@@ -77,7 +77,7 @@ static DEFINE_MUTEX(video_list_lock); ...@@ -77,7 +77,7 @@ static DEFINE_MUTEX(video_list_lock);
static LIST_HEAD(video_bus_head); static LIST_HEAD(video_bus_head);
static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_add(struct acpi_device *device);
static void acpi_video_bus_remove(struct acpi_device *device); static void acpi_video_bus_remove(struct acpi_device *device);
static void acpi_video_bus_notify(struct acpi_device *device, u32 event); static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data);
/* /*
* Indices in the _BCL method response: the first two items are special, * Indices in the _BCL method response: the first two items are special,
...@@ -104,7 +104,6 @@ static struct acpi_driver acpi_video_bus = { ...@@ -104,7 +104,6 @@ static struct acpi_driver acpi_video_bus = {
.ops = { .ops = {
.add = acpi_video_bus_add, .add = acpi_video_bus_add,
.remove = acpi_video_bus_remove, .remove = acpi_video_bus_remove,
.notify = acpi_video_bus_notify,
}, },
}; };
...@@ -1527,8 +1526,9 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video) ...@@ -1527,8 +1526,9 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
acpi_osi_is_win8() ? 0 : 1); acpi_osi_is_win8() ? 0 : 1);
} }
static void acpi_video_bus_notify(struct acpi_device *device, u32 event) static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
{ {
struct acpi_device *device = data;
struct acpi_video_bus *video = acpi_driver_data(device); struct acpi_video_bus *video = acpi_driver_data(device);
struct input_dev *input; struct input_dev *input;
int keycode = 0; int keycode = 0;
...@@ -2053,8 +2053,19 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -2053,8 +2053,19 @@ static int acpi_video_bus_add(struct acpi_device *device)
acpi_video_bus_add_notify_handler(video); acpi_video_bus_add_notify_handler(video);
error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify);
if (error)
goto err_remove;
return 0; return 0;
err_remove:
mutex_lock(&video_list_lock);
list_del(&video->entry);
mutex_unlock(&video_list_lock);
acpi_video_bus_remove_notify_handler(video);
acpi_video_bus_unregister_backlight(video);
err_put_video: err_put_video:
acpi_video_bus_put_devices(video); acpi_video_bus_put_devices(video);
kfree(video->attached_array); kfree(video->attached_array);
...@@ -2075,6 +2086,9 @@ static void acpi_video_bus_remove(struct acpi_device *device) ...@@ -2075,6 +2086,9 @@ static void acpi_video_bus_remove(struct acpi_device *device)
video = acpi_driver_data(device); video = acpi_driver_data(device);
acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify);
mutex_lock(&video_list_lock); mutex_lock(&video_list_lock);
list_del(&video->entry); list_del(&video->entry);
mutex_unlock(&video_list_lock); mutex_unlock(&video_list_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment