diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-03 18:39:58 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-05 11:40:54 -0500 |
commit | b6708fbf98ac01d27c8d4d7f7b4fa87583b658cc (patch) | |
tree | ae8b0feb88ac0bbe648dc9069611ed78d9bd0b44 | |
parent | bbcbfc0eed6220591ccc5752edd079099bb1920c (diff) |
ACPI / hotplug / PCI: Drop acpiphp_bus_add()
acpiphp_bus_add() is only called from one place, so move the code out
of it into that place and drop it. Also make that code use
func_to_acpi_device() to get the struct acpi_device pointer it needs
instead of calling acpi_bus_get_device() which may be costly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 896a13bf2e02..27abd501c258 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -491,20 +491,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
491 | return max; | 491 | return max; |
492 | } | 492 | } |
493 | 493 | ||
494 | /** | ||
495 | * acpiphp_bus_add - Scan ACPI namespace subtree. | ||
496 | * @handle: ACPI object handle to start the scan from. | ||
497 | */ | ||
498 | static void acpiphp_bus_add(acpi_handle handle) | ||
499 | { | ||
500 | struct acpi_device *adev = NULL; | ||
501 | |||
502 | acpi_bus_scan(handle); | ||
503 | acpi_bus_get_device(handle, &adev); | ||
504 | if (acpi_device_enumerated(adev)) | ||
505 | acpi_device_set_power(adev, ACPI_STATE_D0); | ||
506 | } | ||
507 | |||
508 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) | 494 | static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) |
509 | { | 495 | { |
510 | struct acpiphp_func *func; | 496 | struct acpiphp_func *func; |
@@ -544,9 +530,13 @@ static int acpiphp_rescan_slot(struct acpiphp_slot *slot) | |||
544 | { | 530 | { |
545 | struct acpiphp_func *func; | 531 | struct acpiphp_func *func; |
546 | 532 | ||
547 | list_for_each_entry(func, &slot->funcs, sibling) | 533 | list_for_each_entry(func, &slot->funcs, sibling) { |
548 | acpiphp_bus_add(func_to_handle(func)); | 534 | struct acpi_device *adev = func_to_acpi_device(func); |
549 | 535 | ||
536 | acpi_bus_scan(adev->handle); | ||
537 | if (acpi_device_enumerated(adev)) | ||
538 | acpi_device_set_power(adev, ACPI_STATE_D0); | ||
539 | } | ||
550 | return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0)); | 540 | return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0)); |
551 | } | 541 | } |
552 | 542 | ||