Added support of CPU hot-remove via an ACPI eject notification.
It calls acpi_bus_hot_remove_device(), which shares the same code
path with the sysfs eject operation.  acpi_os_hotplug_execute()
runs the hot-remove operation in kacpi_hotplug_wq and serializes
it between ACPI hot-remove and sysfs eject requests.

Signed-off-by: Toshi Kani <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Tested-by: IgorMammedov <[email protected]>
Tested-by: Vijay Mohan Pandarathil <[email protected]>
Tested-by: Prarit Bhargava <[email protected]>
---
 drivers/acpi/processor_driver.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index bd4e5dc..ac63b6f 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -695,8 +695,8 @@ int acpi_processor_device_add(acpi_handle handle, struct 
acpi_device **device)
 static void acpi_processor_hotplug_notify(acpi_handle handle,
                                          u32 event, void *data)
 {
-       struct acpi_processor *pr;
        struct acpi_device *device = NULL;
+       struct acpi_eject_event *ej_event = NULL;
        u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
        int result;
 
@@ -728,20 +728,27 @@ static void acpi_processor_hotplug_notify(acpi_handle 
handle,
                                  "received ACPI_NOTIFY_EJECT_REQUEST\n"));
 
                if (acpi_bus_get_device(handle, &device)) {
-                       printk(KERN_ERR PREFIX
-                                   "Device don't exist, dropping EJECT\n");
+                       pr_err(PREFIX "Device don't exist, dropping EJECT\n");
                        break;
                }
-               pr = acpi_driver_data(device);
-               if (!pr) {
-                       printk(KERN_ERR PREFIX
-                                   "Driver data is NULL, dropping EJECT\n");
+               if (!acpi_driver_data(device)) {
+                       pr_err(PREFIX "Driver data is NULL, dropping EJECT\n");
                        break;
                }
 
-               /* REVISIT: update when eject is supported */
-               ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
-               break;
+               ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL);
+               if (!ej_event) {
+                       pr_err(PREFIX "No memory, dropping EJECT\n");
+                       break;
+               }
+
+               ej_event->handle = handle;
+               ej_event->event = ACPI_NOTIFY_EJECT_REQUEST;
+               acpi_os_hotplug_execute(acpi_bus_hot_remove_device,
+                                       (void *)ej_event);
+
+               /* eject is performed asynchronously */
+               return;
 
        default:
                ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to