static void acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) { struct acpi_device *device = NULL; struct acpi_eject_event *ej_event = NULL; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ acpi_status status; int result; acpi_scan_lock_acquire(); switch (event) { case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor driver received %s event\n", (event == ACPI_NOTIFY_BUS_CHECK) ? "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); if (!is_processor_present(handle)) break; if (!acpi_bus_get_device(handle, &device)) break; result = acpi_bus_scan(handle); if (result) { acpi_handle_err(handle, "Unable to add the device\n"); break; } result = acpi_bus_get_device(handle, &device); if (result) { acpi_handle_err(handle, "Missing device object\n"); break; } ost_code = ACPI_OST_SC_SUCCESS; break; case ACPI_NOTIFY_EJECT_REQUEST: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { acpi_handle_err(handle, "Device don't exist, dropping EJECT\n"); break; } if (!acpi_driver_data(device)) { acpi_handle_err(handle, "Driver data is NULL, dropping EJECT\n"); break; } ej_event = kmalloc(sizeof(*ej_event), GFP_KERNEL); if (!ej_event) { acpi_handle_err(handle, "No memory, dropping EJECT\n"); break; } get_device(&device->dev); ej_event->device = device; ej_event->event = ACPI_NOTIFY_EJECT_REQUEST; /* The eject is carried out asynchronously. */ status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, ej_event); if (ACPI_FAILURE(status)) { put_device(&device->dev); kfree(ej_event); break; } goto out; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); /* non-hotplug event; possibly handled by other handler */ goto out; } /* Inform firmware that the hotplug operation has completed */ (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); out: acpi_scan_lock_release(); }
static void acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) { struct acpi_processor *pr; struct acpi_device *device = NULL; u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ int result; acpi_scan_lock_acquire(); switch (event) { case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_DEVICE_CHECK: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor driver received %s event\n", (event == ACPI_NOTIFY_BUS_CHECK) ? "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK")); if (!is_processor_present(handle)) break; if (!acpi_bus_get_device(handle, &device)) break; result = acpi_bus_scan(handle); if (result) { pr_err(PREFIX "Unable to add the device\n"); break; } result = acpi_bus_get_device(handle, &device); if (result) { pr_err(PREFIX "Missing device object\n"); break; } ost_code = ACPI_OST_SC_SUCCESS; break; case ACPI_NOTIFY_EJECT_REQUEST: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "received ACPI_NOTIFY_EJECT_REQUEST\n")); if (acpi_bus_get_device(handle, &device)) { pr_err(PREFIX "Device don't exist, dropping EJECT\n"); break; } pr = acpi_driver_data(device); if (!pr) { pr_err(PREFIX "Driver data is NULL, dropping EJECT\n"); break; } /* * TBD: implement acpi_processor_device_remove if Xen support * CPU hotremove in the future. */ acpi_processor_device_remove(device); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); /* non-hotplug event; possibly handled by other handler */ goto out; } (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); out: acpi_scan_lock_release(); }