Skip to content

Commit 8ab17fc

Browse files
committed
ACPI / hotplug: Generate online uevents for ACPI containers
Commit 46394fd (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: 46394fd (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>
1 parent 9e82bf0 commit 8ab17fc

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎drivers/acpi/container.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,21 @@ static void container_device_detach(struct acpi_device *adev)
9999
device_unregister(dev);
100100
}
101101

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+
102109
static struct acpi_scan_handler container_handler = {
103110
.ids = container_device_ids,
104111
.attach = container_device_attach,
105112
.detach = container_device_detach,
106113
.hotplug = {
107114
.enabled = true,
108115
.demand_offline = true,
116+
.notify_online = container_device_online,
109117
},
110118
};
111119

‎drivers/acpi/scan.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device)
21892189
ok:
21902190
list_for_each_entry(child, &device->children, node)
21912191
acpi_bus_attach(child);
2192+
2193+
if (device->handler && device->handler->hotplug.notify_online)
2194+
device->handler->hotplug.notify_online(device);
21922195
}
21932196

21942197
/**

‎include/acpi/acpi_bus.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ struct acpi_device;
118118
struct acpi_hotplug_profile {
119119
struct kobject kobj;
120120
int (*scan_dependent)(struct acpi_device *adev);
121+
void (*notify_online)(struct acpi_device *adev);
121122
bool enabled:1;
122123
bool demand_offline:1;
123124
};

0 commit comments

Comments
 (0)