[PATCH 2/4] ACPI: introduce new acpi execute type for device hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zhang Rui <rui.zhang@xxxxxxxxx>

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 <rui.zhang@xxxxxxxxx>
---
 drivers/acpi/osl.c      |   20 ++++++++++++++++++--
 include/acpi/acpiosxf.h |    3 ++-
 2 files changed, 20 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/acpi/osl.c
===================================================================
--- linux-2.6.orig/drivers/acpi/osl.c
+++ linux-2.6/drivers/acpi/osl.c
@@ -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);
 }
 
Index: linux-2.6/include/acpi/acpiosxf.h
===================================================================
--- linux-2.6.orig/include/acpi/acpiosxf.h
+++ linux-2.6/include/acpi/acpiosxf.h
@@ -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)


-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux