diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-03 17:05:29 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-04 08:25:32 -0500 |
commit | a33ec399e9fc266ba20f9b71d693aa63658bf2aa (patch) | |
tree | 404418949973ac053cfe02df039124d7189db1ed /include/acpi | |
parent | c56980744ed99994799850903627c4bbb5fed006 (diff) |
ACPI / scan: Introduce common code for ACPI-based device hotplug
Multiple drivers handling hotplug-capable ACPI device nodes install
notify handlers covering the same types of events in a very similar
way. Moreover, those handlers are installed in separate namespace
walks, although that really should be done during namespace scans
carried out by acpi_bus_scan(). This leads to substantial code
duplication, unnecessary overhead and behavior that is hard to
follow.
For this reason, introduce common code in drivers/acpi/scan.c for
handling hotplug-related notification and carrying out device
insertion and eject operations in a generic fashion, such that it
may be used by all of the relevant drivers in the future. To cover
the existing differences between those drivers introduce struct
acpi_hotplug_profile for representing collections of hotplug
settings associated with different ACPI scan handlers that can be
used by the drivers to make the common code reflect their current
behavior.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Tested-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/acpi_bus.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index e65278f560c4..f2c1d08a4798 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -88,11 +88,23 @@ struct acpi_device; | |||
88 | * ----------------- | 88 | * ----------------- |
89 | */ | 89 | */ |
90 | 90 | ||
91 | enum acpi_hotplug_mode { | ||
92 | AHM_GENERIC = 0, | ||
93 | AHM_CONTAINER, | ||
94 | AHM_COUNT | ||
95 | }; | ||
96 | |||
97 | struct acpi_hotplug_profile { | ||
98 | bool enabled:1; | ||
99 | enum acpi_hotplug_mode mode; | ||
100 | }; | ||
101 | |||
91 | struct acpi_scan_handler { | 102 | struct acpi_scan_handler { |
92 | const struct acpi_device_id *ids; | 103 | const struct acpi_device_id *ids; |
93 | struct list_head list_node; | 104 | struct list_head list_node; |
94 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); | 105 | int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id); |
95 | void (*detach)(struct acpi_device *dev); | 106 | void (*detach)(struct acpi_device *dev); |
107 | struct acpi_hotplug_profile hotplug; | ||
96 | }; | 108 | }; |
97 | 109 | ||
98 | /* | 110 | /* |