提交 236105db 编写于 作者: L Lan Tianyu 提交者: Rafael J. Wysocki

ACPI: Run fixed event device notifications in process context

Currently, notify callbacks for fixed button events are run from
interrupt context.  That is not necessary and after commit 0bf6368e
(ACPI / button: Add ACPI Button event via netlink routine) it causes
netlink routines to be called from interrupt context which is not
correct.

Also, that is different from non-fixed device events (including
non-fixed button events) whose notify callbacks are all executed from
process context.

For the above reasons, make fixed button device notify callbacks run
in process context which will avoid the deadlock when using netlink
to report button events to user space.

Fixes: 0bf6368e (ACPI / button: Add ACPI Button event via netlink routine)
Link: https://lkml.org/lkml/2014/8/21/606Reported-by: NBenjamin Block <bebl@mageta.org>
Reported-by: NKnut Petersen <Knut_Petersen@t-online.de>
Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
[rjw: Function names, subject and changelog.]
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 fc2e0a83
...@@ -922,12 +922,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -922,12 +922,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
device->driver->ops.notify(device, event); device->driver->ops.notify(device, event);
} }
static acpi_status acpi_device_notify_fixed(void *data) static void acpi_device_notify_fixed(void *data)
{ {
struct acpi_device *device = data; struct acpi_device *device = data;
/* Fixed hardware devices have no handles */ /* Fixed hardware devices have no handles */
acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
}
static acpi_status acpi_device_fixed_event(void *data)
{
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
return AE_OK; return AE_OK;
} }
...@@ -938,12 +943,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device) ...@@ -938,12 +943,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
status = status =
acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_device_notify_fixed, acpi_device_fixed_event,
device); device);
else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
status = status =
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_device_notify_fixed, acpi_device_fixed_event,
device); device);
else else
status = acpi_install_notify_handler(device->handle, status = acpi_install_notify_handler(device->handle,
...@@ -960,10 +965,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device) ...@@ -960,10 +965,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
{ {
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_device_notify_fixed); acpi_device_fixed_event);
else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_device_notify_fixed); acpi_device_fixed_event);
else else
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
acpi_device_notify); acpi_device_notify);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册