ACPI: run ACPI device hot removal in kacpi_hotplug_wq

Now that new interface is available,
convert to using it rather than creating a new kernel thread.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Zhang Rui 2009-06-22 11:31:16 +08:00 committed by Len Brown
parent c02256be79
commit c8d72a5e76

View File

@ -95,7 +95,7 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha
} }
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
static int acpi_bus_hot_remove_device(void *context) static void acpi_bus_hot_remove_device(void *context)
{ {
struct acpi_device *device; struct acpi_device *device;
acpi_handle handle = context; acpi_handle handle = context;
@ -104,10 +104,10 @@ static int acpi_bus_hot_remove_device(void *context)
acpi_status status = AE_OK; acpi_status status = AE_OK;
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return 0; return;
if (!device) if (!device)
return 0; return;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Hot-removing device %s...\n", dev_name(&device->dev))); "Hot-removing device %s...\n", dev_name(&device->dev)));
@ -115,7 +115,7 @@ static int acpi_bus_hot_remove_device(void *context)
if (acpi_bus_trim(device, 1)) { if (acpi_bus_trim(device, 1)) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Removing device failed\n"); "Removing device failed\n");
return -1; return;
} }
/* power off device */ /* power off device */
@ -142,9 +142,10 @@ static int acpi_bus_hot_remove_device(void *context)
*/ */
status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; printk(KERN_WARNING PREFIX
"Eject device failed\n");
return 0; return;
} }
static ssize_t static ssize_t
@ -155,7 +156,6 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
acpi_status status; acpi_status status;
acpi_object_type type = 0; acpi_object_type type = 0;
struct acpi_device *acpi_device = to_acpi_device(d); struct acpi_device *acpi_device = to_acpi_device(d);
struct task_struct *task;
if ((!count) || (buf[0] != '1')) { if ((!count) || (buf[0] != '1')) {
return -EINVAL; return -EINVAL;
@ -172,11 +172,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
goto err; goto err;
} }
/* remove the device in another thread to fix the deadlock issue */ acpi_os_hotplug_execute(acpi_bus_hot_remove_device, acpi_device->handle);
task = kthread_run(acpi_bus_hot_remove_device,
acpi_device->handle, "acpi_hot_remove_device");
if (IS_ERR(task))
ret = PTR_ERR(task);
err: err:
return ret; return ret;
} }