Fix pci_claim_resource
authorMatthew Wilcox <willy@linux.intel.com>
Wed, 17 Jun 2009 20:33:33 +0000 (16:33 -0400)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Jun 2009 21:04:42 +0000 (14:04 -0700)
Instead of starting from the iomem or ioport roots, start from the
parent bus' resources.  This fixes a bug where child resources would
appear above their parents resources if they had the same size.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Tested-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pci/setup-res.c

index 3039fcb..1240351 100644 (file)
@@ -99,11 +99,11 @@ void pci_update_resource(struct pci_dev *dev, int resno)
 int pci_claim_resource(struct pci_dev *dev, int resource)
 {
        struct resource *res = &dev->resource[resource];
 int pci_claim_resource(struct pci_dev *dev, int resource)
 {
        struct resource *res = &dev->resource[resource];
-       struct resource *root = NULL;
+       struct resource *root;
        char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
        int err;
 
        char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
        int err;
 
-       root = pcibios_select_root(dev, res);
+       root = pci_find_parent_resource(dev, res);
 
        err = -EINVAL;
        if (root != NULL)
 
        err = -EINVAL;
        if (root != NULL)