aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-03 18:39:20 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-05 11:40:37 -0500
commitb2118d6a4073e394312072b6666cb576e18653b2 (patch)
tree7819efae2acbf5f5dd08828e2260e54b87ec50c7 /drivers/pci/hotplug/acpiphp_glue.c
parent4dc3082dc1dd1415177d71f15d4b19bebb1365c0 (diff)
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index caeef648287a..a0d6c83ac27b 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -638,11 +638,8 @@ static void disable_slot(struct acpiphp_slot *slot)
638 slot->flags &= (~SLOT_ENABLED); 638 slot->flags &= (~SLOT_ENABLED);
639} 639}
640 640
641static bool acpiphp_no_hotplug(acpi_handle handle) 641static bool acpiphp_no_hotplug(struct acpi_device *adev)
642{ 642{
643 struct acpi_device *adev = NULL;
644
645 acpi_bus_get_device(handle, &adev);
646 return adev && adev->flags.no_hotplug; 643 return adev && adev->flags.no_hotplug;
647} 644}
648 645
@@ -650,10 +647,13 @@ static bool slot_no_hotplug(struct acpiphp_slot *slot)
650{ 647{
651 struct acpiphp_func *func; 648 struct acpiphp_func *func;
652 649
653 list_for_each_entry(func, &slot->funcs, sibling) 650 list_for_each_entry(func, &slot->funcs, sibling) {
654 if (acpiphp_no_hotplug(func_to_handle(func))) 651 struct acpi_device *adev = NULL;
655 return true;
656 652
653 acpi_bus_get_device(func_to_handle(func), &adev);
654 if (acpiphp_no_hotplug(adev))
655 return true;
656 }
657 return false; 657 return false;
658} 658}
659 659
@@ -710,13 +710,12 @@ static void trim_stale_devices(struct pci_dev *dev)
710 bool alive = false; 710 bool alive = false;
711 711
712 if (adev) { 712 if (adev) {
713 acpi_handle handle = adev->handle;
714 acpi_status status; 713 acpi_status status;
715 unsigned long long sta; 714 unsigned long long sta;
716 715
717 status = acpi_evaluate_integer(handle, "_STA", NULL, &sta); 716 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta);
718 alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL) 717 alive = (ACPI_SUCCESS(status) && sta == ACPI_STA_ALL)
719 || acpiphp_no_hotplug(handle); 718 || acpiphp_no_hotplug(adev);
720 } 719 }
721 if (!alive) { 720 if (!alive) {
722 u32 v; 721 u32 v;