PCI: Use pci_is_bridge() to simplify code
authorYijing Wang <wangyijing@huawei.com>
Sun, 4 May 2014 04:23:38 +0000 (12:23 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 27 May 2014 20:53:41 +0000 (14:53 -0600)
Use pci_is_bridge() to simplify code.  No functional change.

Requires: 326c1cdae741 PCI: Rename pci_is_bridge() to pci_has_subordinate()
Requires: 1c86438c9423 PCI: Add new pci_is_bridge() interface
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci-acpi.c
drivers/pci/probe.c
drivers/pci/setup-bus.c

index f49abef884852d3780b1d0fdb354257fee0235bf..ca4927ba84334a2b64b09b8b2e9eb60564024f65 100644 (file)
@@ -309,13 +309,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev)
        bool check_children;
        u64 addr;
 
-       /*
-        * pci_is_bridge() is not suitable here, because pci_dev->subordinate
-        * is set only after acpi_pci_find_device() has been called for the
-        * given device.
-        */
-       check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
-                       || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
+       check_children = pci_is_bridge(pci_dev);
        /* Please ref to ACPI spec for the syntax of _ADR */
        addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
        return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
index ef09f5f2fe6c0bc7f0ba84ae06eaa9d46adea4e6..f831dd80fa2dec8c458a5d8c9c33889d943283b5 100644 (file)
@@ -1670,8 +1670,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
 
        for (pass=0; pass < 2; pass++)
                list_for_each_entry(dev, &bus->devices, bus_list) {
-                       if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-                           dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
+                       if (pci_is_bridge(dev))
                                max = pci_scan_bridge(bus, dev, max, pass);
                }
 
index 138bdd6393be87b2ebc63ba35b1b4edaa228b8ad..e399d00ed5fb9f5450d27253f4969bb8d21af15d 100644 (file)
@@ -1629,9 +1629,7 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus)
 
        down_read(&pci_bus_sem);
        list_for_each_entry(dev, &bus->devices, bus_list)
-               if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
-                   dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
-                       if (dev->subordinate)
+               if (pci_is_bridge(dev) && pci_has_subordinate(dev))
                                __pci_bus_size_bridges(dev->subordinate,
                                                         &add_list);
        up_read(&pci_bus_sem);