diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-22 15:55:32 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-22 15:55:32 -0500 |
commit | 46394fd017c0615982a3d29d45ced14bea9c526d (patch) | |
tree | 403b87b00dfdb0368519ed4c52ae8f0428569310 | |
parent | 3338db0057ed9f554050bd06863731c515d79672 (diff) |
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>
-rw-r--r-- | drivers/acpi/container.c | 11 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 8 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 7 |
3 files changed, 9 insertions, 17 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index e23151667655..83d232c10f13 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -44,19 +44,24 @@ static const struct acpi_device_id container_device_ids[] = { | |||
44 | {"", 0}, | 44 | {"", 0}, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int container_device_attach(struct acpi_device *device, | 47 | static int container_device_attach(struct acpi_device *adev, |
48 | const struct acpi_device_id *not_used) | 48 | const struct acpi_device_id *not_used) |
49 | { | 49 | { |
50 | /* This is necessary for container hotplug to work. */ | 50 | kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE); |
51 | return 1; | 51 | return 1; |
52 | } | 52 | } |
53 | 53 | ||
54 | static void container_device_detach(struct acpi_device *adev) | ||
55 | { | ||
56 | kobject_uevent(&adev->dev.kobj, KOBJ_OFFLINE); | ||
57 | } | ||
58 | |||
54 | static struct acpi_scan_handler container_handler = { | 59 | static struct acpi_scan_handler container_handler = { |
55 | .ids = container_device_ids, | 60 | .ids = container_device_ids, |
56 | .attach = container_device_attach, | 61 | .attach = container_device_attach, |
62 | .detach = container_device_detach, | ||
57 | .hotplug = { | 63 | .hotplug = { |
58 | .enabled = true, | 64 | .enabled = true, |
59 | .mode = AHM_CONTAINER, | ||
60 | }, | 65 | }, |
61 | }; | 66 | }; |
62 | 67 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 18865c86c463..b1b8f4304597 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -206,9 +206,6 @@ static int acpi_scan_hot_remove(struct acpi_device *device) | |||
206 | acpi_status status; | 206 | acpi_status status; |
207 | unsigned long long sta; | 207 | unsigned long long sta; |
208 | 208 | ||
209 | if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER) | ||
210 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | ||
211 | |||
212 | /* | 209 | /* |
213 | * Carry out two passes here and ignore errors in the first pass, | 210 | * Carry out two passes here and ignore errors in the first pass, |
214 | * because if the devices in question are memory blocks and | 211 | * because if the devices in question are memory blocks and |
@@ -288,10 +285,7 @@ static int acpi_scan_device_check(struct acpi_device *adev) | |||
288 | dev_warn(&adev->dev, "Namespace scan failure\n"); | 285 | dev_warn(&adev->dev, "Namespace scan failure\n"); |
289 | return error; | 286 | return error; |
290 | } | 287 | } |
291 | if (adev->handler) { | 288 | if (!adev->handler) { |
292 | if (adev->handler->hotplug.mode == AHM_CONTAINER) | ||
293 | kobject_uevent(&adev->dev.kobj, KOBJ_ONLINE); | ||
294 | } else { | ||
295 | dev_warn(&adev->dev, "Enumeration failure\n"); | 289 | dev_warn(&adev->dev, "Enumeration failure\n"); |
296 | return -ENODEV; | 290 | return -ENODEV; |
297 | } | 291 | } |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 2359c69f1680..3e4150b6d71a 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -91,16 +91,9 @@ struct acpi_device; | |||
91 | * ----------------- | 91 | * ----------------- |
92 | */ | 92 | */ |
93 | 93 | ||
94 | enum acpi_hotplug_mode { | ||
95 | AHM_GENERIC = 0, | ||
96 | AHM_CONTAINER, | ||
97 | AHM_COUNT | ||
98 | }; | ||
99 | |||
100 | struct acpi_hotplug_profile { | 94 | struct acpi_hotplug_profile { |
101 | struct kobject kobj; | 95 | struct kobject kobj; |
102 | bool enabled:1; | 96 | bool enabled:1; |
103 | enum acpi_hotplug_mode mode; | ||
104 | int (*scan_dependent)(struct acpi_device *adev); | 97 | int (*scan_dependent)(struct acpi_device *adev); |
105 | }; | 98 | }; |
106 | 99 | ||