diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-05 04:32:28 +0100 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-02-26 22:42:09 +0100 |
commit | 5edb93b89f6cc3089ee283656555e7a9ad36a8a0 (patch) | |
tree | 496964f830aa06af8351de8645ec7e19ef931264 /drivers/pci/host-bridge.c | |
parent | i2o: Use pci_bus_alloc_resource(), not allocate_resource() directly (diff) | |
download | linux-5edb93b89f6cc3089ee283656555e7a9ad36a8a0.tar.xz linux-5edb93b89f6cc3089ee283656555e7a9ad36a8a0.zip |
resource: Add resource_contains()
We have two identical copies of resource_contains() already, and more
places that could use it. This moves it to ioport.h where it can be
shared.
resource_contains(struct resource *r1, struct resource *r2) returns true
iff r1 and r2 are the same type (most callers already checked this
separately) and the r1 address range completely contains r2.
In addition, the new resource_contains() checks that both r1 and r2 have
addresses assigned to them. If a resource is IORESOURCE_UNSET, it doesn't
have a valid address and can't contain or be contained by another resource.
Some callers already check this or for res->start.
No functional change.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/host-bridge.c')
-rw-r--r-- | drivers/pci/host-bridge.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c index 06ace6248c61..47aaf22d814e 100644 --- a/drivers/pci/host-bridge.c +++ b/drivers/pci/host-bridge.c @@ -32,11 +32,6 @@ void pci_set_host_bridge_release(struct pci_host_bridge *bridge, bridge->release_data = release_data; } -static bool resource_contains(struct resource *res1, struct resource *res2) -{ - return res1->start <= res2->start && res1->end >= res2->end; -} - void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, struct resource *res) { @@ -45,9 +40,6 @@ void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, resource_size_t offset = 0; list_for_each_entry(window, &bridge->windows, list) { - if (resource_type(res) != resource_type(window->res)) - continue; - if (resource_contains(window->res, res)) { offset = window->offset; break; |