Skip to content

Commit 46394fd

Browse files
committed
ACPI / hotplug: Move container-specific code out of the core
Move container-specific uevents from the core hotplug code to the container scan handler's .attach() and .detach() callbacks. This way the core will not have to special-case containers and the uevents will be guaranteed to happen every time a container is either scanned or trimmed as appropriate. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 3338db0 commit 46394fd

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

‎drivers/acpi/container.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,24 @@ static const struct acpi_device_id container_device_ids[] = {
4444
{"", 0},
4545
};
4646

47-
static int container_device_attach(struct acpi_device *device,
47+
static int container_device_attach(struct acpi_device *adev,
4848
const struct acpi_device_id *not_used)
4949
{
50-
/* This is necessary for container hotplug to work. */
50+
kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE);
5151
return 1;
5252
}
5353

54+
static void container_device_detach(struct acpi_device *adev)
55+
{
56+
kobject_uevent(&adev->dev.kobj, KOBJ_OFFLINE);
57+
}
58+
5459
static struct acpi_scan_handler container_handler = {
5560
.ids = container_device_ids,
5661
.attach = container_device_attach,
62+
.detach = container_device_detach,
5763
.hotplug = {
5864
.enabled = true,
59-
.mode = AHM_CONTAINER,
6065
},
6166
};
6267

‎drivers/acpi/scan.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
206206
acpi_status status;
207207
unsigned long long sta;
208208

209-
if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
210-
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
211-
212209
/*
213210
* Carry out two passes here and ignore errors in the first pass,
214211
* because if the devices in question are memory blocks and
@@ -288,10 +285,7 @@ static int acpi_scan_device_check(struct acpi_device *adev)
288285
dev_warn(&adev->dev, "Namespace scan failure\n");
289286
return error;
290287
}
291-
if (adev->handler) {
292-
if (adev->handler->hotplug.mode == AHM_CONTAINER)
293-
kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE);
294-
} else {
288+
if (!adev->handler) {
295289
dev_warn(&adev->dev, "Enumeration failure\n");
296290
return -ENODEV;
297291
}

‎include/acpi/acpi_bus.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,9 @@ struct acpi_device;
9191
* -----------------
9292
*/
9393

94-
enum acpi_hotplug_mode {
95-
AHM_GENERIC = 0,
96-
AHM_CONTAINER,
97-
AHM_COUNT
98-
};
99-
10094
struct acpi_hotplug_profile {
10195
struct kobject kobj;
10296
bool enabled:1;
103-
enum acpi_hotplug_mode mode;
10497
int (*scan_dependent)(struct acpi_device *adev);
10598
};
10699

0 commit comments

Comments
 (0)