]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Make pci_claim_resource() use request_resource() rather than insert_resource()
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 2 Aug 2009 21:04:19 +0000 (14:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 2 Aug 2009 21:10:18 +0000 (14:10 -0700)
This function has traditionally used "insert_resource()", because before
commit cebd78a8c5 ("Fix pci_claim_resource") it used to just insert the
resource into whatever root resource tree that was indicated by

So there Matthew fixed it to actually look up the proper parent
resource, which means that now it's actively wrong to then traverse the
resource tree any more: we already know exactly where the new resource
should go.

And when we then did commit a76117dfd6 ("x86: Use pci_claim_resource"),
which changed the x86 PCI code from the open-coded

pr = pci_find_parent_resource(dev, r);
if (!pr || request_resource(pr, r) < 0) {

to using

if (pci_claim_resource(dev, idx) < 0) {

that "insert_resource()" now suddenly became a problem, and causes a
regression covered by


which this fixes.

Reported-and-tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Andrew Patterson <andrew.patterson@hp.com>
Cc: Linux PCI <linux-pci@vger.kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

index b711fb7181e241f1a744482d8151fd6ca9beb290..1898c7b47907b81cb456d8a06391f47dc4b7f4d7 100644 (file)
@@ -100,16 +100,16 @@ int pci_claim_resource(struct pci_dev *dev, int resource)
        struct resource *res = &dev->resource[resource];
        struct resource *root;
-       char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
        int err;
        root = pci_find_parent_resource(dev, res);
        err = -EINVAL;
        if (root != NULL)
-               err = insert_resource(root, res);
+               err = request_resource(root, res);
        if (err) {
+               const char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
                dev_err(&dev->dev, "BAR %d: %s of %s %pR\n",
                        root ? "address space collision on" :