PCI: acpiphp: Replace local macros with standard ACPI macros
[firefly-linux-kernel-4.4.55.git] / drivers / pci / hotplug / acpiphp_glue.c
index 270fdbadc19c93e97b62db8049a1542a748b1223..718464f8fd40885b1bc06c56eec168c31f71e0cf 100644 (file)
@@ -487,7 +487,7 @@ static int add_bridge(struct acpi_pci_root *root)
                        dbg("%s: _STA evaluation failure\n", __func__);
                        return 0;
                }
-               if ((tmp & ACPI_STA_FUNCTIONING) == 0)
+               if ((tmp & ACPI_STA_DEVICE_FUNCTIONING) == 0)
                        /* don't register this object */
                        return 0;
        }
@@ -914,13 +914,6 @@ static int disable_device(struct acpiphp_slot *slot)
        struct pci_dev *pdev;
        struct pci_bus *bus = slot->bridge->pci_bus;
 
-       /* The slot will be enabled when func 0 is added, so check
-          func 0 before disable the slot. */
-       pdev = pci_get_slot(bus, PCI_DEVFN(slot->device, 0));
-       if (!pdev)
-               goto err_exit;
-       pci_dev_put(pdev);
-
        list_for_each_entry(func, &slot->funcs, sibling) {
                if (func->bridge) {
                        /* cleanup p2p bridges under this P2P bridge */
@@ -1082,11 +1075,11 @@ static void acpiphp_set_hpp_values(struct pci_bus *bus)
  */
 static void acpiphp_sanitize_bus(struct pci_bus *bus)
 {
-       struct pci_dev *dev;
+       struct pci_dev *dev, *tmp;
        int i;
        unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM;
 
-       list_for_each_entry(dev, &bus->devices, bus_list) {
+       list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
                for (i=0; i<PCI_BRIDGE_RESOURCES; i++) {
                        struct resource *res = &dev->resource[i];
                        if ((res->flags & type_mask) && !res->start &&
@@ -1396,7 +1389,7 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot)
 
        sta = get_slot_status(slot);
 
-       return (sta & ACPI_STA_SHOW_IN_UI) ? 0 : 1;
+       return (sta & ACPI_STA_DEVICE_UI) ? 0 : 1;
 }