Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <isimatu.yasuaki@jp.fujitsu.com>
Cc: 3.14+ <stable@vger.kernel.org> # 3.14+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+12
+8
drivers/acpi/container.c
··· 99 99 device_unregister(dev); 100 100 } 101 101 102 + static void container_device_online(struct acpi_device *adev) 103 + { 104 + struct device *dev = acpi_driver_data(adev); 105 + 106 + kobject_uevent(&dev->kobj, KOBJ_ONLINE); 107 + } 108 + 102 109 static struct acpi_scan_handler container_handler = { 103 110 .ids = container_device_ids, 104 111 .attach = container_device_attach, ··· 113 106 .hotplug = { 114 107 .enabled = true, 115 108 .demand_offline = true, 109 + .notify_online = container_device_online, 116 110 }, 117 111 }; 118 112
+3
drivers/acpi/scan.c
··· 2189 2189 ok: 2190 2190 list_for_each_entry(child, &device->children, node) 2191 2191 acpi_bus_attach(child); 2192 + 2193 + if (device->handler && device->handler->hotplug.notify_online) 2194 + device->handler->hotplug.notify_online(device); 2192 2195 } 2193 2196 2194 2197 /**
+1
include/acpi/acpi_bus.h
··· 118 118 struct acpi_hotplug_profile { 119 119 struct kobject kobj; 120 120 int (*scan_dependent)(struct acpi_device *adev); 121 + void (*notify_online)(struct acpi_device *adev); 121 122 bool enabled:1; 122 123 bool demand_offline:1; 123 124 };