ACPI: introduce new acpi execute type for device hotplug
Subsystems (2)
PATCH 2/4 ACPI: introduce new acpi execute type for device hotplug
From: Zhang Rui <[email protected]>
Introduce new acpi_execute_type OSL_DEVICE_HOTPLUG_HANDLER for device hotplug. so that we can move the device hotplug notify handler to keventd_wq and flush kacpi_notify_wq before removing the per-device notify handler.
Signed-off-by Zhang Rui <[email protected]>
--- drivers/acpi/osl.c | 20 ++++++++++++++++++-- include/acpi/acpiosxf.h | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-)
drivers/acpi/osl.c +18 -2
@@ -684,13 +684,27 @@ acpi_status acpi_os_execute(acpi_execute dpc->function = function; dpc->context = context; -if (type ==OSL_NOTIFY_HANDLER ) { +switch (type) { +case OSL_NOTIFY_HANDLER :INIT_WORK (&dpc->work, acpi_os_execute_notify);if (!queue_work (kacpi_notify_wq, &dpc->work)) { status =AE_ERROR ;kfree (dpc); } - }else { +break ; +case OSL_DEVICE_HOTPLUG_HANDLER : +/* +* execute device hotplug in keventd_wq so that it +* can flush kacpi_notify_wq and kacpid_wq before +* removing the notify handler. +*/ +INIT_WORK (&dpc->work, acpi_os_execute_notify); +if (!schedule_work (&dpc->work)) { + status =AE_ERROR ; +kfree (dpc); + } +break ; +default :INIT_WORK (&dpc->work, acpi_os_execute_deferred);if (!queue_work (kacpid_wq, &dpc->work)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -698,7 +712,9 @@ acpi_status acpi_os_execute(acpi_execute status =AE_ERROR ;kfree (dpc); } +break ; } +return_ACPI_STATUS (status); }
include/acpi/acpiosxf.h +2 -1
@@ -58,7 +58,8 @@ typedef enum {OSL_GPE_HANDLER ,OSL_DEBUGGER_THREAD ,OSL_EC_POLL_HANDLER , - OSL_EC_BURST_HANDLER +OSL_EC_BURST_HANDLER , + OSL_DEVICE_HOTPLUG_HANDLER } acpi_execute_type;#define ACPI_NO_UNIT_LIMIT ((u32) -1)