diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-03 18:38:52 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-02-05 11:40:34 -0500 |
commit | 4dc3082dc1dd1415177d71f15d4b19bebb1365c0 (patch) | |
tree | 263be780eed03e3f933c0ec0f1ed4017f3d507fe | |
parent | 146fc68a4bdd78e49d56f1530f6b8072034cf3ef (diff) |
ACPI / hotplug / PCI: Drop acpiphp_bus_trim()
If trim_stale_devices() calls acpi_bus_trim() directly, we can
save a potentially costly acpi_bus_get_device() invocation. After
making that change acpiphp_bus_trim() would only be called from one
place, so move the code from it to that place and drop it.
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 | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index c97454c74c26..caeef648287a 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -489,19 +489,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | /** | 491 | /** |
492 | * acpiphp_bus_trim - Trim device objects in an ACPI namespace subtree. | ||
493 | * @handle: ACPI device object handle to start from. | ||
494 | */ | ||
495 | static void acpiphp_bus_trim(acpi_handle handle) | ||
496 | { | ||
497 | struct acpi_device *adev = NULL; | ||
498 | |||
499 | acpi_bus_get_device(handle, &adev); | ||
500 | if (adev) | ||
501 | acpi_bus_trim(adev); | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * acpiphp_bus_add - Scan ACPI namespace subtree. | 492 | * acpiphp_bus_add - Scan ACPI namespace subtree. |
506 | * @handle: ACPI object handle to start the scan from. | 493 | * @handle: ACPI object handle to start the scan from. |
507 | */ | 494 | */ |
@@ -641,8 +628,12 @@ static void disable_slot(struct acpiphp_slot *slot) | |||
641 | if (PCI_SLOT(dev->devfn) == slot->device) | 628 | if (PCI_SLOT(dev->devfn) == slot->device) |
642 | pci_stop_and_remove_bus_device(dev); | 629 | pci_stop_and_remove_bus_device(dev); |
643 | 630 | ||
644 | list_for_each_entry(func, &slot->funcs, sibling) | 631 | list_for_each_entry(func, &slot->funcs, sibling) { |
645 | acpiphp_bus_trim(func_to_handle(func)); | 632 | struct acpi_device *adev; |
633 | |||
634 | if (!acpi_bus_get_device(func_to_handle(func), &adev)) | ||
635 | acpi_bus_trim(adev); | ||
636 | } | ||
646 | 637 | ||
647 | slot->flags &= (~SLOT_ENABLED); | 638 | slot->flags &= (~SLOT_ENABLED); |
648 | } | 639 | } |
@@ -714,11 +705,12 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) | |||
714 | */ | 705 | */ |
715 | static void trim_stale_devices(struct pci_dev *dev) | 706 | static void trim_stale_devices(struct pci_dev *dev) |
716 | { | 707 | { |
717 | acpi_handle handle = ACPI_HANDLE(&dev->dev); | 708 | struct acpi_device *adev = ACPI_COMPANION(&dev->dev); |
718 | struct pci_bus *bus = dev->subordinate; | 709 | struct pci_bus *bus = dev->subordinate; |
719 | bool alive = false; | 710 | bool alive = false; |
720 | 711 | ||
721 | if (handle) { | 712 | if (adev) { |
713 | acpi_handle handle = adev->handle; | ||
722 | acpi_status status; | 714 | acpi_status status; |
723 | unsigned long long sta; | 715 | unsigned long long sta; |
724 | 716 | ||
@@ -734,8 +726,8 @@ static void trim_stale_devices(struct pci_dev *dev) | |||
734 | } | 726 | } |
735 | if (!alive) { | 727 | if (!alive) { |
736 | pci_stop_and_remove_bus_device(dev); | 728 | pci_stop_and_remove_bus_device(dev); |
737 | if (handle) | 729 | if (adev) |
738 | acpiphp_bus_trim(handle); | 730 | acpi_bus_trim(adev); |
739 | } else if (bus) { | 731 | } else if (bus) { |
740 | struct pci_dev *child, *tmp; | 732 | struct pci_dev *child, *tmp; |
741 | 733 | ||