vserver 1.9.3
[linux-2.6.git] / drivers / pci / probe.c
index 736a56f..e88017d 100644 (file)
@@ -326,7 +326,7 @@ struct pci_bus * __devinit pci_add_new_bus(struct pci_bus *parent, struct pci_de
        return child;
 }
 
-static unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus);
+unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus);
 
 /*
  * If it's a bridge, configure it and scan the bus behind it.
@@ -373,7 +373,10 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max
                child->bridge_ctl = bctl;
 
                cmax = pci_scan_child_bus(child);
-               if (cmax > max) max = cmax;
+               if (cmax > max)
+                       max = cmax;
+               if (child->subordinate > max)
+                       max = child->subordinate;
        } else {
                /*
                 * We need to assign a number to this bus which we always
@@ -571,6 +574,11 @@ static int pci_cfg_space_size(struct pci_dev *dev)
        return PCI_CFG_SPACE_SIZE;
 }
 
+static void pci_release_bus_bridge_dev(struct device *dev)
+{
+       kfree(dev);
+}
+
 /*
  * Read the config data for a PCI device, sanity-check it
  * and fill in the dev structure...
@@ -640,7 +648,7 @@ pci_scan_single_device(struct pci_bus *bus, int devfn)
                return NULL;
        
        /* Fix up broken headers */
-       pci_fixup_device(PCI_FIXUP_HEADER, dev);
+       pci_fixup_device(pci_fixup_header, dev);
 
        /*
         * Add the device to our list of discovered devices
@@ -694,7 +702,7 @@ int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
        return nr;
 }
 
-static unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
+unsigned int __devinit pci_scan_child_bus(struct pci_bus *bus)
 {
        unsigned int devfn, pass, max = bus->secondary;
        struct pci_dev *dev;
@@ -772,6 +780,7 @@ struct pci_bus * __devinit pci_scan_bus_parented(struct device *parent, int bus,
 
        memset(dev, 0, sizeof(*dev));
        dev->parent = parent;
+       dev->release = pci_release_bus_bridge_dev;
        sprintf(dev->bus_id, "pci%04x:%02x", pci_domain_nr(b), bus);
        device_register(dev);
        b->bridge = get_device(dev);
@@ -801,4 +810,5 @@ EXPORT_SYMBOL(pci_do_scan_bus);
 EXPORT_SYMBOL(pci_scan_slot);
 EXPORT_SYMBOL(pci_scan_bridge);
 EXPORT_SYMBOL(pci_scan_single_device);
+EXPORT_SYMBOL_GPL(pci_scan_child_bus);
 #endif