diff options
| author | Alex Chiang <achiang@hp.com> | 2009-03-31 11:24:17 -0400 |
|---|---|---|
| committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-06-11 15:04:16 -0400 |
| commit | 12a9da0fcb147b46de33bb919b1de2bb92c9e2a9 (patch) | |
| tree | b5e2f6c019f42f13e263110255fd2184963b1a48 /drivers/pci/hotplug/cpqphp_pci.c | |
| parent | 6d1e87daeeba864a18535b7f3aed0e65f5f52275 (diff) | |
PCI Hotplug: cpqphp: don't use pci_find_slot()
Convert uses of pci_find_slot to modern API.
In the conversion sites, we end up calling pci_dev_put() right away.
This may seem like it misses the entire point of doing something like
pci_get_bus_and_slot(), since we drop the reference so soon, but it turns
out we don't actually do much with the returned pci_dev.
I plan on untangling cpqphp further, but clearly cpqphp never worried too
much about a properly refcounted pci_dev anyway. For now, this conversion
seems reasonable, as it gets rid of the last in-tree caller of pci_find_slot.
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/hotplug/cpqphp_pci.c')
| -rw-r--r-- | drivers/pci/hotplug/cpqphp_pci.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c index 3e3acc7e7461..6173b9a4544e 100644 --- a/drivers/pci/hotplug/cpqphp_pci.c +++ b/drivers/pci/hotplug/cpqphp_pci.c | |||
| @@ -88,7 +88,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | |||
| 88 | int num; | 88 | int num; |
| 89 | 89 | ||
| 90 | if (func->pci_dev == NULL) | 90 | if (func->pci_dev == NULL) |
| 91 | func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function)); | 91 | func->pci_dev = pci_get_bus_and_slot(func->bus,PCI_DEVFN(func->device, func->function)); |
| 92 | 92 | ||
| 93 | /* No pci device, we need to create it then */ | 93 | /* No pci device, we need to create it then */ |
| 94 | if (func->pci_dev == NULL) { | 94 | if (func->pci_dev == NULL) { |
| @@ -98,7 +98,7 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | |||
| 98 | if (num) | 98 | if (num) |
| 99 | pci_bus_add_devices(ctrl->pci_dev->bus); | 99 | pci_bus_add_devices(ctrl->pci_dev->bus); |
| 100 | 100 | ||
| 101 | func->pci_dev = pci_find_slot(func->bus, PCI_DEVFN(func->device, func->function)); | 101 | func->pci_dev = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, func->function)); |
| 102 | if (func->pci_dev == NULL) { | 102 | if (func->pci_dev == NULL) { |
| 103 | dbg("ERROR: pci_dev still null\n"); | 103 | dbg("ERROR: pci_dev still null\n"); |
| 104 | return 0; | 104 | return 0; |
| @@ -111,6 +111,8 @@ int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func) | |||
| 111 | pci_do_scan_bus(child); | 111 | pci_do_scan_bus(child); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | pci_dev_put(func->pci_dev); | ||
| 115 | |||
| 114 | return 0; | 116 | return 0; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| @@ -122,9 +124,11 @@ int cpqhp_unconfigure_device(struct pci_func* func) | |||
| 122 | dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); | 124 | dbg("%s: bus/dev/func = %x/%x/%x\n", __func__, func->bus, func->device, func->function); |
| 123 | 125 | ||
| 124 | for (j=0; j<8 ; j++) { | 126 | for (j=0; j<8 ; j++) { |
| 125 | struct pci_dev* temp = pci_find_slot(func->bus, PCI_DEVFN(func->device, j)); | 127 | struct pci_dev* temp = pci_get_bus_and_slot(func->bus, PCI_DEVFN(func->device, j)); |
| 126 | if (temp) | 128 | if (temp) { |
| 129 | pci_dev_put(temp); | ||
| 127 | pci_remove_bus_device(temp); | 130 | pci_remove_bus_device(temp); |
| 131 | } | ||
| 128 | } | 132 | } |
| 129 | return 0; | 133 | return 0; |
| 130 | } | 134 | } |
| @@ -406,7 +410,7 @@ int cpqhp_save_config(struct controller *ctrl, int busnumber, int is_hot_plug) | |||
| 406 | new_slot->switch_save = 0x10; | 410 | new_slot->switch_save = 0x10; |
| 407 | /* In case of unsupported board */ | 411 | /* In case of unsupported board */ |
| 408 | new_slot->status = DevError; | 412 | new_slot->status = DevError; |
| 409 | new_slot->pci_dev = pci_find_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function); | 413 | new_slot->pci_dev = pci_get_bus_and_slot(new_slot->bus, (new_slot->device << 3) | new_slot->function); |
| 410 | 414 | ||
| 411 | for (cloop = 0; cloop < 0x20; cloop++) { | 415 | for (cloop = 0; cloop < 0x20; cloop++) { |
| 412 | rc = pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(device, function), cloop << 2, (u32 *) & (new_slot-> config_space [cloop])); | 416 | 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) | |||
| 414 | return rc; | 418 | return rc; |
| 415 | } | 419 | } |
| 416 | 420 | ||
| 421 | pci_dev_put(new_slot->pci_dev); | ||
| 422 | |||
| 417 | function++; | 423 | function++; |
| 418 | 424 | ||
| 419 | stop_it = 0; | 425 | stop_it = 0; |
