diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-04 03:39:33 +0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-05 20:40:39 +0400 |
commit | bbcbfc0eed6220591ccc5752edd079099bb1920c (patch) | |
tree | 1fdcf26676d7ebcc1af5d34712c4e83a6edee95c /drivers/pci/hotplug/acpiphp.h | |
parent | b2118d6a4073e394312072b6666cb576e18653b2 (diff) | |
download | linux-bbcbfc0eed6220591ccc5752edd079099bb1920c.tar.xz |
ACPI / hotplug / PCI: Store acpi_device pointer in acpiphp_context
After recent modifications of the ACPI core making it create a struct
acpi_device object for every namespace node representing a device
regardless of the current status of that device the ACPIPHP code
can store a struct acpi_device pointer instead of an ACPI handle
in struct acpiphp_context. This immediately makes it possible to
avoid making potentially costly calls to acpi_bus_get_device() in
two places and allows some more simplifications to be made going
forward.
The reason why that is correct is because ACPIPHP only installs
hotify handlers for namespace nodes that exist when
acpiphp_enumerate_slots() is called for their parent bridge.
That only happens if the parent bridge has an ACPI companion
associated with it, which means that the ACPI namespace scope
in question has been scanned already at that point. That, in
turn, means that struct acpi_device objects have been created
for all namespace nodes in that scope and pointers to those
objects can be stored directly instead of their ACPI handles.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci/hotplug/acpiphp.h')
-rw-r--r-- | drivers/pci/hotplug/acpiphp.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index b6162be4df40..098ff425f850 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h @@ -117,8 +117,8 @@ struct acpiphp_func { }; struct acpiphp_context { - acpi_handle handle; struct acpiphp_func func; + struct acpi_device *adev; struct acpiphp_bridge *bridge; unsigned int refcount; }; @@ -128,9 +128,14 @@ static inline struct acpiphp_context *func_to_context(struct acpiphp_func *func) return container_of(func, struct acpiphp_context, func); } +static inline struct acpi_device *func_to_acpi_device(struct acpiphp_func *func) +{ + return func_to_context(func)->adev; +} + static inline acpi_handle func_to_handle(struct acpiphp_func *func) { - return func_to_context(func)->handle; + return func_to_acpi_device(func)->handle; } /* |