From patchwork Tue Jan 15 03:12:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [-v3, 5/7] PCI, cpcihp: use bus->devices list instead of traditional traversal Date: Mon, 14 Jan 2013 17:12:20 -0000 From: Yijing Wang X-Patchwork-Id: 211981 Message-Id: <1358219542-16880-6-git-send-email-wangyijing@huawei.com> To: Bjorn Helgaas , Yu Zhao Cc: Kenji Kaneshige , Scott Murray , Yinghai Lu , , Hanjun Guo , , Yijing Wang From: Bjorn Helgaas Use bus->devices list to traverse the pci function devices when configure or unconfigure the slot like other pci hotplug drivers. Signed-off-by: Bjorn Helgaas Signed-off-by: Yijing Wang --- drivers/pci/hotplug/cpci_hotplug_pci.c | 13 +++---------- 1 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c index dcc75c7..9329642 100644 --- a/drivers/pci/hotplug/cpci_hotplug_pci.c +++ b/drivers/pci/hotplug/cpci_hotplug_pci.c @@ -252,8 +252,8 @@ int cpci_led_off(struct slot* slot) int __ref cpci_configure_slot(struct slot *slot) { + struct pci_dev *dev; struct pci_bus *parent; - int fn; dbg("%s - enter", __func__); @@ -282,18 +282,11 @@ int __ref cpci_configure_slot(struct slot *slot) } parent = slot->dev->bus; - for (fn = 0; fn < 8; fn++) { - struct pci_dev *dev; - - dev = pci_get_slot(parent, - PCI_DEVFN(PCI_SLOT(slot->devfn), fn)); - if (!dev) - continue; + list_for_each_entry(dev, &parent->devices, bus_list) if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) pci_hp_add_bridge(dev); - pci_dev_put(dev); - } + pci_assign_unassigned_bridge_resources(parent->self);