===================================================================
@@ -1855,11 +1855,26 @@ void acpi_scan_hotplug_enabled(struct ac
mutex_unlock(&acpi_scan_lock);
}
+static struct acpi_hotplug_profile *acpi_container_hotplug(
+ struct acpi_device_pnp *pnp)
+{
+ if (acpi_container_scan_handler()) {
+ struct acpi_scan_handler *handler;
+ struct acpi_hardware_id *hwid;
+
+ handler = acpi_container_scan_handler();
+ list_for_each_entry(hwid, &pnp->ids, list)
+ if (acpi_scan_handler_matching(handler, hwid->id, NULL))
+ return handler->hotplug;
+ }
+ return NULL;
+}
+
static void acpi_scan_init_hotplug(acpi_handle handle, int type)
{
struct acpi_device_pnp pnp = {};
struct acpi_hardware_id *hwid;
- struct acpi_scan_handler *handler;
+ struct acpi_hotplug_profile *hotplug = NULL;
INIT_LIST_HEAD(&pnp.ids);
acpi_set_pnp_ids(handle, &pnp, type);
@@ -1872,14 +1887,20 @@ static void acpi_scan_init_hotplug(acpi_
* install the same notify handler routine twice for the same handle.
*/
list_for_each_entry(hwid, &pnp.ids, list) {
+ struct acpi_scan_handler *handler;
+
handler = acpi_scan_match_handler(hwid->id, NULL);
if (handler && handler->hotplug) {
- acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
- acpi_hotplug_notify_cb,
- handler->hotplug);
+ hotplug = handler->hotplug;
break;
}
}
+ if (!hotplug)
+ hotplug = acpi_container_hotplug(&pnp);
+
+ if (hotplug)
+ acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
+ acpi_hotplug_notify_cb, hotplug);
out:
acpi_free_pnp_ids(&pnp);
@@ -1948,7 +1969,9 @@ static int acpi_scan_attach_handler(stru
ret = handler->attach(device, devid);
if (ret > 0) {
device->handler = handler;
- device->hotplug = handler->hotplug;
+ device->hotplug = handler->hotplug ?
+ handler->hotplug :
+ acpi_container_hotplug(&device->pnp);
break;
} else if (ret < 0) {
break;