ACPI / ACPICA: ACPI / ACPICA: Multiple system notify handlers per device
Subsystems (2)
PATCH 1/1 ACPI / ACPICA: ACPI / ACPICA: Multiple system notify handlers per device
From: Rafael J. Wysocki <[email protected]>
Currently it only is possible to install one system notify handler per namespace node, but this is not enough for PCI run-time power management, because we need to install power management notifiers for devices that already have hotplug notifiers installed. While in principle this could be handled at the PCI level, that would be suboptimal due to the way in which the ACPI-based PCI hotplug code is designed.
For this reason, modify ACPICA so that it is possible to install more than one system notify handler per namespace node. Namely, make acpi_install_notify_handler(), acpi_remove_notify_handler() and acpi_ev_notify_dispatch() use a list of system notify handler objects associated with a namespace node.
Make acpi_remove_notify_handler() call acpi_os_wait_events_complete() upfront to avoid a situation in which concurrent instance of acpi_remove_notify_handler() removes the handler from under us while we're waiting for the event queues to flush.
---
This patch is necessary for the PCI run-time PM patches, as stated above in the changelog. I've tested it on a couple of machines and haven't had any problems with it.
Please have a look and tell me what you think.
Rafael
--- drivers/acpi/acpica/acobject.h | 2 drivers/acpi/acpica/evmisc.c | 12 ++ drivers/acpi/acpica/evxface.c | 175 ++++++++++++++++++++++++++++++++--------- 3 files changed, 150 insertions(+), 39 deletions(-)
drivers/acpi/acpica/acobject.h +2 -0
@@ -287,8 +287,10 @@ struct acpi_object_buffer_field {struct acpi_object_notify_handler { ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */ +u32 handler_type;acpi_notify_handler handler;void *context; +struct acpi_object_notify_handler *next; };struct acpi_object_addr_handler {
drivers/acpi/acpica/evxface.c +139 -36
232 lines not on this page · raw message
drivers/acpi/acpica/evmisc.c +9 -3
@@ -259,9 +259,15 @@ static void ACPI_SYSTEM_XFACE acpi_ev_no handler_obj = notify_info->notify.handler_obj;if (handler_obj) { - handler_obj->notify.handler (notify_info->notify.node, - notify_info->notify.value, - handler_obj->notify.context); +struct acpi_object_notify_handler *notifier; + + notifier = &handler_obj->notify; +while (notifier) { + notifier->handler (notify_info->notify.node, + notify_info->notify.value, + notifier->context); + notifier = notifier->next; + } }/* All done with the info object */