Commit b2118d6a authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

ACPI / hotplug / PCI: Rework acpiphp_no_hotplug()

If a struct acpi_device pointer is passed to acpiphp_no_hotplug()
instead of an ACPI handle, the function won't need to call
acpi_bus_get_device(), which may be costly, any more.  Then,
trim_stale_devices() can call acpiphp_no_hotplug() passing
the struct acpi_device object it already has directly to that
function.

Make those changes and update slot_no_hotplug() accordingly.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 4dc3082d
...@@ -638,11 +638,8 @@ static void disable_slot(struct acpiphp_slot *slot) ...@@ -638,11 +638,8 @@ static void disable_slot(struct acpiphp_slot *slot)
slot->flags &= (~SLOT_ENABLED); slot->flags &= (~SLOT_ENABLED);
} }
static bool acpiphp_no_hotplug(acpi_handle handle) static bool acpiphp_no_hotplug(struct acpi_device *adev)
{ {
struct acpi_device *adev = NULL;
acpi_bus_get_device(handle, &adev);
return adev && adev->flags.no_hotplug; return adev && adev->flags.no_hotplug;
} }
...@@ -650,10 +647,13 @@ static bool slot_no_hotplug(struct acpiphp_slot *slot) ...@@ -650,10 +647,13 @@ static bool slot_no_hotplug(struct acpiphp_slot *slot)
{ {
struct acpiphp_func *func; struct acpiphp_func *func;
list_for_each_entry(func, &slot->funcs, sibling) list_for_each_entry(func, &slot->funcs, sibling) {
if (acpiphp_no_hotplug(func_to_handle(func))) struct acpi_device *adev = NULL;
return true;
acpi_bus_get_device(func_to_handle(func), &adev);
if (acpiphp_no_hotplug(adev))
return true;
}
return false; return false;
} }
...@@ -710,13 +710,12 @@ static void trim_stale_devices(struct pci_dev *dev) ...@@ -710,13 +710,12 @@ static void trim_stale_devices(struct pci_dev *dev)
bool alive = false; bool alive = false;
if (adev) { if (adev) {
acpi_handle handle = adev->handle;
acpi_status status; acpi_status status;
unsigned long long sta; unsigned long long sta;
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL) alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL)
|| acpiphp_no_hotplug(handle); || acpiphp_no_hotplug(adev);
} }
if (!alive) { if (!alive) {
u32 v; u32 v;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment