提交 43d38883 编写于 作者: R Rafael J. Wysocki

ACPI / hotplug: Carry out PCI root eject directly

Since _handle_hotplug_event_root() is run from the ACPI hotplug
workqueue, it doesn't need to queue up a work item to eject a PCI
host bridge on the same workqueue.  Instead, it can just carry out
the eject by calling acpi_bus_device_eject() directly, so make that
happen.
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 a3b1b1ef
...@@ -87,7 +87,7 @@ void acpi_device_add_finalize(struct acpi_device *device); ...@@ -87,7 +87,7 @@ void acpi_device_add_finalize(struct acpi_device *device);
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
int acpi_bind_one(struct device *dev, acpi_handle handle); int acpi_bind_one(struct device *dev, acpi_handle handle);
int acpi_unbind_one(struct device *dev); int acpi_unbind_one(struct device *dev);
void acpi_bus_hot_remove_device(void *context); void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src);
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Power Resource Power Resource
......
...@@ -592,16 +592,6 @@ static void handle_root_bridge_insertion(acpi_handle handle) ...@@ -592,16 +592,6 @@ static void handle_root_bridge_insertion(acpi_handle handle)
acpi_handle_err(handle, "cannot add bridge to acpi list\n"); acpi_handle_err(handle, "cannot add bridge to acpi list\n");
} }
static void handle_root_bridge_removal(struct acpi_device *device)
{
acpi_status status;
get_device(&device->dev);
status = acpi_os_hotplug_execute(acpi_bus_hot_remove_device, device);
if (ACPI_FAILURE(status))
put_device(&device->dev);
}
static void _handle_hotplug_event_root(struct work_struct *work) static void _handle_hotplug_event_root(struct work_struct *work)
{ {
struct acpi_pci_root *root; struct acpi_pci_root *root;
...@@ -612,6 +602,7 @@ static void _handle_hotplug_event_root(struct work_struct *work) ...@@ -612,6 +602,7 @@ static void _handle_hotplug_event_root(struct work_struct *work)
hp_work = container_of(work, struct acpi_hp_work, work); hp_work = container_of(work, struct acpi_hp_work, work);
handle = hp_work->handle; handle = hp_work->handle;
type = hp_work->type; type = hp_work->type;
kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
acpi_scan_lock_acquire(); acpi_scan_lock_acquire();
...@@ -641,9 +632,15 @@ static void _handle_hotplug_event_root(struct work_struct *work) ...@@ -641,9 +632,15 @@ static void _handle_hotplug_event_root(struct work_struct *work)
/* request device eject */ /* request device eject */
acpi_handle_printk(KERN_DEBUG, handle, acpi_handle_printk(KERN_DEBUG, handle,
"Device eject notify on %s\n", __func__); "Device eject notify on %s\n", __func__);
if (root) if (!root)
handle_root_bridge_removal(root->device);
break; break;
get_device(&root->device->dev);
acpi_scan_lock_release();
acpi_bus_device_eject(root->device, ACPI_NOTIFY_EJECT_REQUEST);
return;
default: default:
acpi_handle_warn(handle, acpi_handle_warn(handle,
"notify_handler: unknown event type 0x%x\n", "notify_handler: unknown event type 0x%x\n",
...@@ -652,7 +649,6 @@ static void _handle_hotplug_event_root(struct work_struct *work) ...@@ -652,7 +649,6 @@ static void _handle_hotplug_event_root(struct work_struct *work)
} }
acpi_scan_lock_release(); acpi_scan_lock_release();
kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
} }
static void handle_hotplug_event_root(acpi_handle handle, u32 type, static void handle_hotplug_event_root(acpi_handle handle, u32 type,
......
...@@ -285,7 +285,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device) ...@@ -285,7 +285,7 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
return 0; return 0;
} }
static void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src) void acpi_bus_device_eject(struct acpi_device *device, u32 ost_src)
{ {
acpi_handle handle = device->handle; acpi_handle handle = device->handle;
struct acpi_scan_handler *handler; struct acpi_scan_handler *handler;
...@@ -409,7 +409,7 @@ static void acpi_hotplug_unsupported(acpi_handle handle, u32 type) ...@@ -409,7 +409,7 @@ static void acpi_hotplug_unsupported(acpi_handle handle, u32 type)
* acpi_bus_hot_remove_device: Hot-remove a device and its children. * acpi_bus_hot_remove_device: Hot-remove a device and its children.
* @context: Address of the ACPI device object to hot-remove. * @context: Address of the ACPI device object to hot-remove.
*/ */
void acpi_bus_hot_remove_device(void *context) static void acpi_bus_hot_remove_device(void *context)
{ {
acpi_bus_device_eject(context, ACPI_NOTIFY_EJECT_REQUEST); acpi_bus_device_eject(context, ACPI_NOTIFY_EJECT_REQUEST);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册