Commit fffa93ce authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Greg Kroah-Hartman

ACPI / hotplug: Generate online uevents for ACPI containers

commit 8ab17fc9 upstream.

Commit 46394fd0 (ACPI / hotplug: Move container-specific code out of
the core) removed the generation of "online" uevents for containers,
because "add" uevents are now generated for them automatically when
container system devices are registered.  However, there are user
space tools that need to be notified when the container and all of
its children have been enumerated, which doesn't happen any more.

For this reason, add a mechanism allowing "online" uevents to be
generated for ACPI containers after enumerating the container along
with all of its children.

Fixes: 46394fd0 (ACPI / hotplug: Move container-specific code out of the core)
Reported-and-tested-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9d39ba1
...@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev) ...@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev)
device_unregister(dev); device_unregister(dev);
} }
static void container_device_online(struct acpi_device *adev)
{
struct device *dev = acpi_driver_data(adev);
kobject_uevent(&dev->kobj, KOBJ_ONLINE);
}
static struct acpi_scan_handler container_handler = { static struct acpi_scan_handler container_handler = {
.ids = container_device_ids, .ids = container_device_ids,
.attach = container_device_attach, .attach = container_device_attach,
...@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = { ...@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = {
.hotplug = { .hotplug = {
.enabled = true, .enabled = true,
.demand_offline = true, .demand_offline = true,
.notify_online = container_device_online,
}, },
}; };
......
...@@ -2184,6 +2184,9 @@ static void acpi_bus_attach(struct acpi_device *device) ...@@ -2184,6 +2184,9 @@ static void acpi_bus_attach(struct acpi_device *device)
ok: ok:
list_for_each_entry(child, &device->children, node) list_for_each_entry(child, &device->children, node)
acpi_bus_attach(child); acpi_bus_attach(child);
if (device->handler && device->handler->hotplug.notify_online)
device->handler->hotplug.notify_online(device);
} }
/** /**
......
...@@ -118,6 +118,7 @@ struct acpi_device; ...@@ -118,6 +118,7 @@ struct acpi_device;
struct acpi_hotplug_profile { struct acpi_hotplug_profile {
struct kobject kobj; struct kobject kobj;
int (*scan_dependent)(struct acpi_device *adev); int (*scan_dependent)(struct acpi_device *adev);
void (*notify_online)(struct acpi_device *adev);
bool enabled:1; bool enabled:1;
bool demand_offline:1; bool demand_offline:1;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment