aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2014-05-04 00:23:38 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-05-27 16:53:41 -0400
commit6788a51fe3391817c8ded5f43dd4c57f3d212c17 (patch)
tree499f69d27cb71ccdd3127cc030e2bf96e1fcbe02
parent1c86438c9423a26cc9f7f74a8950d9cf9c93bc23 (diff)
PCI: Use pci_is_bridge() to simplify code
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>
-rw-r--r--drivers/pci/pci-acpi.c8
-rw-r--r--drivers/pci/probe.c3
-rw-r--r--drivers/pci/setup-bus.c4
3 files changed, 3 insertions, 12 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index f49abef88485..ca4927ba8433 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -309,13 +309,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev)
309 bool check_children; 309 bool check_children;
310 u64 addr; 310 u64 addr;
311 311
312 /* 312 check_children = pci_is_bridge(pci_dev);
313 * pci_is_bridge() is not suitable here, because pci_dev->subordinate
314 * is set only after acpi_pci_find_device() has been called for the
315 * given device.
316 */
317 check_children = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
318 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
319 /* Please ref to ACPI spec for the syntax of _ADR */ 313 /* Please ref to ACPI spec for the syntax of _ADR */
320 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 314 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
321 return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, 315 return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index ef09f5f2fe6c..f831dd80fa2d 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1670,8 +1670,7 @@ unsigned int pci_scan_child_bus(struct pci_bus *bus)
1670 1670
1671 for (pass=0; pass < 2; pass++) 1671 for (pass=0; pass < 2; pass++)
1672 list_for_each_entry(dev, &bus->devices, bus_list) { 1672 list_for_each_entry(dev, &bus->devices, bus_list) {
1673 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 1673 if (pci_is_bridge(dev))
1674 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
1675 max = pci_scan_bridge(bus, dev, max, pass); 1674 max = pci_scan_bridge(bus, dev, max, pass);
1676 } 1675 }
1677 1676
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 138bdd6393be..e399d00ed5fb 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -1629,9 +1629,7 @@ void pci_assign_unassigned_bus_resources(struct pci_bus *bus)
1629 1629
1630 down_read(&pci_bus_sem); 1630 down_read(&pci_bus_sem);
1631 list_for_each_entry(dev, &bus->devices, bus_list) 1631 list_for_each_entry(dev, &bus->devices, bus_list)
1632 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 1632 if (pci_is_bridge(dev) && pci_has_subordinate(dev))
1633 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
1634 if (dev->subordinate)
1635 __pci_bus_size_bridges(dev->subordinate, 1633 __pci_bus_size_bridges(dev->subordinate,
1636 &add_list); 1634 &add_list);
1637 up_read(&pci_bus_sem); 1635 up_read(&pci_bus_sem);