Skip to content

Commit

Permalink
ACPI / hotplug: Generate online uevents for ACPI containers
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: 3.14+ <[email protected]> # 3.14+
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
rafaeljw committed Sep 21, 2014
1 parent 9e82bf0 commit 8ab17fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/acpi/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,21 @@ 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,
.detach = container_device_detach,
.hotplug = {
.enabled = true,
.demand_offline = true,
.notify_online = container_device_online,
},
};

Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
1 change: 1 addition & 0 deletions include/acpi/acpi_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 8ab17fc

Please sign in to comment.