diff options
| -rw-r--r-- | drivers/pci/slot.c | 15 | ||||
| -rw-r--r-- | include/linux/pci.h | 2 |
2 files changed, 6 insertions, 11 deletions
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index 0c6db03698ea..b9b90ab6b861 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
| @@ -175,7 +175,7 @@ placeholder: | |||
| 175 | EXPORT_SYMBOL_GPL(pci_create_slot); | 175 | EXPORT_SYMBOL_GPL(pci_create_slot); |
| 176 | 176 | ||
| 177 | /** | 177 | /** |
| 178 | * pci_update_slot_number - update %struct pci_slot -> number | 178 | * pci_renumber_slot - update %struct pci_slot -> number |
| 179 | * @slot - %struct pci_slot to update | 179 | * @slot - %struct pci_slot to update |
| 180 | * @slot_nr - new number for slot | 180 | * @slot_nr - new number for slot |
| 181 | * | 181 | * |
| @@ -183,27 +183,22 @@ EXPORT_SYMBOL_GPL(pci_create_slot); | |||
| 183 | * created a placeholder slot in pci_create_slot() by passing a -1 as | 183 | * created a placeholder slot in pci_create_slot() by passing a -1 as |
| 184 | * slot_nr, to update their %struct pci_slot with the correct @slot_nr. | 184 | * slot_nr, to update their %struct pci_slot with the correct @slot_nr. |
| 185 | */ | 185 | */ |
| 186 | 186 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr) | |
| 187 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr) | ||
| 188 | { | 187 | { |
| 189 | int name_count = 0; | ||
| 190 | struct pci_slot *tmp; | 188 | struct pci_slot *tmp; |
| 191 | 189 | ||
| 192 | down_write(&pci_bus_sem); | 190 | down_write(&pci_bus_sem); |
| 193 | 191 | ||
| 194 | list_for_each_entry(tmp, &slot->bus->slots, list) { | 192 | list_for_each_entry(tmp, &slot->bus->slots, list) { |
| 195 | WARN_ON(tmp->number == slot_nr); | 193 | WARN_ON(tmp->number == slot_nr); |
| 196 | if (!strcmp(kobject_name(&tmp->kobj), kobject_name(&slot->kobj))) | 194 | goto out; |
| 197 | name_count++; | ||
| 198 | } | 195 | } |
| 199 | 196 | ||
| 200 | if (name_count > 1) | ||
| 201 | printk(KERN_WARNING "pci_update_slot_number found %d slots with the same name: %s\n", name_count, kobject_name(&slot->kobj)); | ||
| 202 | |||
| 203 | slot->number = slot_nr; | 197 | slot->number = slot_nr; |
| 198 | out: | ||
| 204 | up_write(&pci_bus_sem); | 199 | up_write(&pci_bus_sem); |
| 205 | } | 200 | } |
| 206 | EXPORT_SYMBOL_GPL(pci_update_slot_number); | 201 | EXPORT_SYMBOL_GPL(pci_renumber_slot); |
| 207 | 202 | ||
| 208 | /** | 203 | /** |
| 209 | * pci_destroy_slot - decrement refcount for physical PCI slot | 204 | * pci_destroy_slot - decrement refcount for physical PCI slot |
diff --git a/include/linux/pci.h b/include/linux/pci.h index ee2fd6304e05..41717ae9807e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -512,7 +512,7 @@ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, | |||
| 512 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, | 512 | struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr, |
| 513 | const char *name); | 513 | const char *name); |
| 514 | void pci_destroy_slot(struct pci_slot *slot); | 514 | void pci_destroy_slot(struct pci_slot *slot); |
| 515 | void pci_update_slot_number(struct pci_slot *slot, int slot_nr); | 515 | void pci_renumber_slot(struct pci_slot *slot, int slot_nr); |
| 516 | int pci_scan_slot(struct pci_bus *bus, int devfn); | 516 | int pci_scan_slot(struct pci_bus *bus, int devfn); |
| 517 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); | 517 | struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); |
| 518 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); | 518 | void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); |
