mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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>
This commit is contained in:
parent
3338db0057
commit
46394fd017
@ -44,19 +44,24 @@ static const struct acpi_device_id container_device_ids[] = {
|
|||||||
{"", 0},
|
{"", 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int container_device_attach(struct acpi_device *device,
|
static int container_device_attach(struct acpi_device *adev,
|
||||||
const struct acpi_device_id *not_used)
|
const struct acpi_device_id *not_used)
|
||||||
{
|
{
|
||||||
/* This is necessary for container hotplug to work. */
|
kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void container_device_detach(struct acpi_device *adev)
|
||||||
|
{
|
||||||
|
kobject_uevent(&adev->dev.kobj, KOBJ_OFFLINE);
|
||||||
|
}
|
||||||
|
|
||||||
static struct acpi_scan_handler container_handler = {
|
static struct acpi_scan_handler container_handler = {
|
||||||
.ids = container_device_ids,
|
.ids = container_device_ids,
|
||||||
.attach = container_device_attach,
|
.attach = container_device_attach,
|
||||||
|
.detach = container_device_detach,
|
||||||
.hotplug = {
|
.hotplug = {
|
||||||
.enabled = true,
|
.enabled = true,
|
||||||
.mode = AHM_CONTAINER,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -206,9 +206,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device)
|
|||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long long sta;
|
unsigned long long sta;
|
||||||
|
|
||||||
if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
|
|
||||||
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Carry out two passes here and ignore errors in the first pass,
|
* Carry out two passes here and ignore errors in the first pass,
|
||||||
* because if the devices in question are memory blocks and
|
* because if the devices in question are memory blocks and
|
||||||
@ -288,10 +285,7 @@ static int acpi_scan_device_check(struct acpi_device *adev)
|
|||||||
dev_warn(&adev->dev, "Namespace scan failure\n");
|
dev_warn(&adev->dev, "Namespace scan failure\n");
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
if (adev->handler) {
|
if (!adev->handler) {
|
||||||
if (adev->handler->hotplug.mode == AHM_CONTAINER)
|
|
||||||
kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE);
|
|
||||||
} else {
|
|
||||||
dev_warn(&adev->dev, "Enumeration failure\n");
|
dev_warn(&adev->dev, "Enumeration failure\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
@ -91,16 +91,9 @@ struct acpi_device;
|
|||||||
* -----------------
|
* -----------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum acpi_hotplug_mode {
|
|
||||||
AHM_GENERIC = 0,
|
|
||||||
AHM_CONTAINER,
|
|
||||||
AHM_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct acpi_hotplug_profile {
|
struct acpi_hotplug_profile {
|
||||||
struct kobject kobj;
|
struct kobject kobj;
|
||||||
bool enabled:1;
|
bool enabled:1;
|
||||||
enum acpi_hotplug_mode mode;
|
|
||||||
int (*scan_dependent)(struct acpi_device *adev);
|
int (*scan_dependent)(struct acpi_device *adev);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user