summaryrefslogtreecommitdiffstats
path: root/drivers/pci/host-bridge.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-04-02 18:31:53 -0700
committerBjorn Helgaas <bhelgaas@google.com>2012-04-30 13:53:08 -0600
commit459f58ce51e2e11235b7bb4b1732ebf3c17d86f7 (patch)
tree8bd4debf12209eb9cdc3f94d4329df12d1835d5e /drivers/pci/host-bridge.c
parentbaa495d9de2af97310128bfc0e365a813b63d5bb (diff)
downloadlinux-459f58ce51e2e11235b7bb4b1732ebf3c17d86f7.tar.gz
linux-459f58ce51e2e11235b7bb4b1732ebf3c17d86f7.tar.bz2
linux-459f58ce51e2e11235b7bb4b1732ebf3c17d86f7.zip
PCI: rename pci_host_bridge() to find_pci_root_bridge()
pci_host_bridge() looks like a C++ constructor. Also separate find_pci_root_bus() out. Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host-bridge.c')
-rw-r--r--drivers/pci/host-bridge.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index 28b24a5375d4..c49a1c482cfb 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -16,15 +16,22 @@ void add_to_pci_host_bridges(struct pci_host_bridge *bridge)
list_add_tail(&bridge->list, &pci_host_bridges);
}
-static struct pci_host_bridge *pci_host_bridge(struct pci_dev *dev)
+static struct pci_bus *find_pci_root_bus(struct pci_dev *dev)
{
struct pci_bus *bus;
- struct pci_host_bridge *bridge;
bus = dev->bus;
while (bus->parent)
bus = bus->parent;
+ return bus;
+}
+
+static struct pci_host_bridge *find_pci_host_bridge(struct pci_dev *dev)
+{
+ struct pci_bus *bus = find_pci_root_bus(dev);
+ struct pci_host_bridge *bridge;
+
list_for_each_entry(bridge, &pci_host_bridges, list) {
if (bridge->bus == bus)
return bridge;
@@ -41,7 +48,7 @@ static bool resource_contains(struct resource *res1, struct resource *res2)
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res)
{
- struct pci_host_bridge *bridge = pci_host_bridge(dev);
+ struct pci_host_bridge *bridge = find_pci_host_bridge(dev);
struct pci_host_bridge_window *window;
resource_size_t offset = 0;
@@ -69,12 +76,13 @@ static bool region_contains(struct pci_bus_region *region1,
void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
struct pci_bus_region *region)
{
- struct pci_host_bridge *bridge = pci_host_bridge(dev);
+ struct pci_host_bridge *bridge = find_pci_host_bridge(dev);
struct pci_host_bridge_window *window;
- struct pci_bus_region bus_region;
resource_size_t offset = 0;
list_for_each_entry(window, &bridge->windows, list) {
+ struct pci_bus_region bus_region;
+
if (resource_type(res) != resource_type(window->res))
continue;