Merge branch 'for-2.6.31' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / pci / hotplug / cpqphp_pci.c
index 3e3acc7..6173b9a 100644 (file)
@@ -88,7 +88,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
        int num;
 
        if (func->pci_dev == NULL)
-               func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function));
+               func->pci_dev = pci_get_bus_and_slot(func->bus,PCI_DEVFN(func->device, func->function));
 
        /* No pci device, we need to create it then */
        if (func->pci_dev == NULL) {
@@ -98,7 +98,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
                if (num)
                        pci_bus_add_devices(ctrl->pci_dev->bus);
 
-               func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function));
+               func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function));
                if (func->pci_dev == NULL) {
                        dbg("ERROR: pci_dev still null\n");
                        return 0;
@@ -111,6 +111,8 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
                pci_do_scan_bus(child);
        }
 
+       pci_dev_put(func->pci_dev);
+
        return 0;
 }
 
@@ -122,9 +124,11 @@ int cpqhp_unconfigure_device(struct pci_func* func)
        dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function);
 
        for (j=0; j<8 ; j++) {
-               struct pci_dev* temp = pci_find_slot(func->bus, PCI_DEVFN(func->device, j));
-               if (temp)
+               struct pci_dev* temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j));
+               if (temp) {
+                       pci_dev_put(temp);
                        pci_remove_bus_device(temp);
+               }
        }
        return 0;
 }
@@ -406,7 +410,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug)
                        new_slot->switch_save = 0x10;
                        /* In case of unsupported board */
                        new_slot->status = DevError;
-                       new_slot->pci_dev = pci_find_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);
+                       new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function);
 
                        for (cloop = 0; cloop < 0x20; cloop++) {
                                rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop]));
@@ -414,6 +418,8 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug)
                                        return rc;
                        }
 
+                       pci_dev_put(new_slot->pci_dev);
+
                        function++;
 
                        stop_it = 0;