]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/pci/setup-bus.c
Merge commit 'v2.6.32-rc5' into perf/probes
[karo-tx-linux.git] / drivers / pci / setup-bus.c
index cb1a027eb552228a08bc53cef27af8e7db34e70e..0959430534b2daae2c8799827936415dad502075 100644 (file)
@@ -299,8 +299,17 @@ static struct resource *find_free_bus_resource(struct pci_bus *bus, unsigned lon
                r = bus->resource[i];
                if (r == &ioport_resource || r == &iomem_resource)
                        continue;
-               if (r && (r->flags & type_mask) == type && !r->parent)
-                       return r;
+               if (r && (r->flags & type_mask) == type) {
+                       if (!r->parent)
+                               return r;
+                       /*
+                        * if there is no child under that, we should release
+                        * and use it. don't need to reset it, pbus_size_* will
+                        * set it again
+                        */
+                       if (!r->child && !release_resource(r))
+                               return r;
+               }
        }
        return NULL;
 }