Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: shpchp: use generic pci_hp_add_bridge()

Use the new generic pci_hp_add_bridge() interface.

[bhelgaas: changelog]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Yinghai Lu and committed by
Bjorn Helgaas
7d01f70a 073ae10c

+15 -32
+15 -32
drivers/pci/hotplug/shpchp_pci.c
··· 37 37 int __ref shpchp_configure_device(struct slot *p_slot) 38 38 { 39 39 struct pci_dev *dev; 40 - struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 41 - int num, fn; 42 40 struct controller *ctrl = p_slot->ctrl; 41 + struct pci_dev *bridge = ctrl->pci_dev; 42 + struct pci_bus *parent = bridge->subordinate; 43 + int num, fn; 43 44 44 45 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 45 46 if (dev) { ··· 62 61 if (!dev) 63 62 continue; 64 63 if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || 65 - (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) { 66 - /* Find an unused bus number for the new bridge */ 67 - struct pci_bus *child; 68 - unsigned char busnr, start = parent->busn_res.start; 69 - unsigned char end = parent->busn_res.end; 70 - int max; 71 - for (busnr = start; busnr <= end; busnr++) { 72 - if (!pci_find_bus(pci_domain_nr(parent), 73 - busnr)) 74 - break; 75 - } 76 - if (busnr > end) { 77 - ctrl_err(ctrl, 78 - "No free bus for hot-added bridge\n"); 79 - pci_dev_put(dev); 80 - continue; 81 - } 82 - child = pci_add_new_bus(parent, dev, busnr); 83 - if (!child) { 84 - ctrl_err(ctrl, "Cannot add new bus for %s\n", 85 - pci_name(dev)); 86 - pci_dev_put(dev); 87 - continue; 88 - } 89 - max = pci_do_scan_bus(child); 90 - pci_bus_update_busn_res_end(child, max); 91 - pci_bus_size_bridges(child); 92 - } 64 + (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) 65 + pci_hp_add_bridge(dev); 66 + pci_dev_put(dev); 67 + } 68 + 69 + pci_assign_unassigned_bridge_resources(bridge); 70 + 71 + for (fn = 0; fn < 8; fn++) { 72 + dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); 73 + if (!dev) 74 + continue; 93 75 pci_configure_slot(dev); 94 76 pci_dev_put(dev); 95 77 } 96 78 97 - pci_bus_assign_resources(parent); 98 79 pci_bus_add_devices(parent); 99 - pci_enable_bridges(parent); 80 + 100 81 return 0; 101 82 } 102 83