From: Rafael J. Wysocki Date: Sun, 21 Sep 2014 00:58:18 +0000 (+0200) Subject: ACPI / hotplug: Generate online uevents for ACPI containers X-Git-Tag: v3.17-rc7~10^2~2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=8ab17fc92e49bc2b8fff9d220c19bf50ec9c1158;p=~emulex%2Finfiniband.git ACPI / hotplug: Generate online uevents for ACPI containers Commit 46394fd01 (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: 46394fd01 (ACPI / hotplug: Move container-specific code out of the core) Reported-and-tested-by: Yasuaki Ishimatsu Cc: 3.14+ # 3.14+ Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 76f7cff6459..c8ead9f9737 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev) 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 = { .ids = container_device_ids, .attach = container_device_attach, @@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = { .hotplug = { .enabled = true, .demand_offline = true, + .notify_online = container_device_online, }, }; diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 3bf7764659a..1c9a664c170 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2189,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) ok: list_for_each_entry(child, &device->children, node) acpi_bus_attach(child); + + if (device->handler && device->handler->hotplug.notify_online) + device->handler->hotplug.notify_online(device); } /** diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index c1c9de19edb..2f98cf84368 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -118,6 +118,7 @@ struct acpi_device; struct acpi_hotplug_profile { struct kobject kobj; int (*scan_dependent)(struct acpi_device *adev); + void (*notify_online)(struct acpi_device *adev); bool enabled:1; bool demand_offline:1; };