]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
PCI: Add pci_find_bus_resource()
authorYinghai Lu <yinghai@kernel.org>
Sat, 18 Jun 2016 02:24:50 +0000 (19:24 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 28 May 2017 02:44:00 +0000 (19:44 -0700)
Add pci_find_bus_resource() to return bus resource for input resource.

In some case, we may only have bus instead of dev.
It is same as pci_find_parent_resource, but take bus as input.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 22855133

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 7f93fc77f440039967ee5a057d49644526a7879f)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/pci/pci.c
include/linux/pci.h

index 49d1d848d315edcd9b4e60d7d8205af97040416d..2ce0c6d8327647b9242d6231405bc145ea13cc77 100644 (file)
@@ -403,18 +403,9 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap)
 }
 EXPORT_SYMBOL_GPL(pci_find_ht_capability);
 
-/**
- * pci_find_parent_resource - return resource region of parent bus of given region
- * @dev: PCI device structure contains resources to be searched
- * @res: child resource record for which parent is sought
- *
- *  For given resource region of given device, return the resource
- *  region of parent bus the given region is contained in.
- */
-struct resource *pci_find_parent_resource(const struct pci_dev *dev,
-                                         struct resource *res)
+struct resource *pci_find_bus_resource(const struct pci_bus *bus,
+                                       struct resource *res)
 {
-       const struct pci_bus *bus = dev->bus;
        struct resource *r;
        int i;
 
@@ -444,6 +435,20 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,
        }
        return NULL;
 }
+
+/**
+ * pci_find_parent_resource - return resource region of parent bus of given region
+ * @dev: PCI device structure contains resources to be searched
+ * @res: child resource record for which parent is sought
+ *
+ *  For given resource region of given device, return the resource
+ *  region of parent bus the given region is contained in.
+ */
+struct resource *pci_find_parent_resource(const struct pci_dev *dev,
+                                         struct resource *res)
+{
+       return pci_find_bus_resource(dev->bus, res);
+}
 EXPORT_SYMBOL(pci_find_parent_resource);
 
 /**
index 8726b6ef1bcba172dbc2d002b36cdc924f597ca9..0301e37ae3452765eb02190e5c0c57fe1ca58232 100644 (file)
@@ -786,6 +786,8 @@ void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region,
                             struct resource *res);
 void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res,
                             struct pci_bus_region *region);
+struct resource *pci_find_bus_resource(const struct pci_bus *bus,
+                                       struct resource *res);
 void pcibios_scan_specific_bus(int busn);
 struct pci_bus *pci_find_bus(int domain, int busnr);
 void pci_bus_add_devices(const struct pci_bus *bus);