aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/cpci_hotplug_pci.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 00:18:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-26 00:18:18 -0500
commit556f12f602ac0a18a82ca83e9f8e8547688fc633 (patch)
treed4051f6dd57968c8e8e660ad117c5bedc2aa7e8e /drivers/pci/hotplug/cpci_hotplug_pci.c
parentfffddfd6c8e0c10c42c6e2cc54ba880fcc36ebbb (diff)
parent018ba0a6efada61b9bc17500101d81c3d35807c2 (diff)
Merge tag 'pci-v3.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI changes from Bjorn Helgaas: "Host bridge hotplug - Major overhaul of ACPI host bridge add/start (Rafael Wysocki, Yinghai Lu) - Major overhaul of PCI/ACPI binding (Rafael Wysocki, Yinghai Lu) - Split out ACPI host bridge and ACPI PCI device hotplug (Yinghai Lu) - Stop caching _PRT and make independent of bus numbers (Yinghai Lu) PCI device hotplug - Clean up cpqphp dead code (Sasha Levin) - Disable ARI unless device and upstream bridge support it (Yijing Wang) - Initialize all hot-added devices (not functions 0-7) (Yijing Wang) Power management - Don't touch ASPM if disabled (Joe Lawrence) - Fix ASPM link state management (Myron Stowe) Miscellaneous - Fix PCI_EXP_FLAGS accessor (Alex Williamson) - Disable Bus Master in pci_device_shutdown (Konstantin Khlebnikov) - Document hotplug resource and MPS parameters (Yijing Wang) - Add accessor for PCIe capabilities (Myron Stowe) - Drop pciehp suspend/resume messages (Paul Bolle) - Make pci_slot built-in only (not a module) (Jiang Liu) - Remove unused PCI/ACPI bind ops (Jiang Liu) - Removed used pci_root_bus (Bjorn Helgaas)" * tag 'pci-v3.9-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (51 commits) PCI/ACPI: Don't cache _PRT, and don't associate them with bus numbers PCI: Fix PCI Express Capability accessors for PCI_EXP_FLAGS ACPI / PCI: Make pci_slot built-in only, not a module PCI/PM: Clear state_saved during suspend PCI: Use atomic_inc_return() rather than atomic_add_return() PCI: Catch attempts to disable already-disabled devices PCI: Disable Bus Master unconditionally in pci_device_shutdown() PCI: acpiphp: Remove dead code for PCI host bridge hotplug PCI: acpiphp: Create companion ACPI devices before creating PCI devices PCI: Remove unused "rc" in virtfn_add_bus() PCI: pciehp: Drop suspend/resume ENTRY messages PCI/ASPM: Don't touch ASPM if forcibly disabled PCI/ASPM: Deallocate upstream link state even if device is not PCIe PCI: Document MPS parameters pci=pcie_bus_safe, pci=pcie_bus_perf, etc PCI: Document hpiosize= and hpmemsize= resource reservation parameters PCI: Use PCI Express Capability accessor PCI: Introduce accessor to retrieve PCIe Capabilities Register PCI: Put pci_dev in device tree as early as possible PCI: Skip attaching driver in device_add() PCI: acpiphp: Keep driver loaded even if no slots found ...
Diffstat (limited to 'drivers/pci/hotplug/cpci_hotplug_pci.c')
-rw-r--r--drivers/pci/hotplug/cpci_hotplug_pci.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
index dcc75c785443..d8add34177f2 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)
252 252
253int __ref cpci_configure_slot(struct slot *slot) 253int __ref cpci_configure_slot(struct slot *slot)
254{ 254{
255 struct pci_dev *dev;
255 struct pci_bus *parent; 256 struct pci_bus *parent;
256 int fn;
257 257
258 dbg("%s - enter", __func__); 258 dbg("%s - enter", __func__);
259 259
@@ -282,18 +282,13 @@ int __ref cpci_configure_slot(struct slot *slot)
282 } 282 }
283 parent = slot->dev->bus; 283 parent = slot->dev->bus;
284 284
285 for (fn = 0; fn < 8; fn++) { 285 list_for_each_entry(dev, &parent->devices, bus_list)
286 struct pci_dev *dev; 286 if (PCI_SLOT(dev->devfn) != PCI_SLOT(slot->devfn))
287
288 dev = pci_get_slot(parent,
289 PCI_DEVFN(PCI_SLOT(slot->devfn), fn));
290 if (!dev)
291 continue; 287 continue;
292 if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) || 288 if ((dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) ||
293 (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)) 289 (dev->hdr_type == PCI_HEADER_TYPE_CARDBUS))
294 pci_hp_add_bridge(dev); 290 pci_hp_add_bridge(dev);
295 pci_dev_put(dev); 291
296 }
297 292
298 pci_assign_unassigned_bridge_resources(parent->self); 293 pci_assign_unassigned_bridge_resources(parent->self);
299 294
@@ -305,8 +300,7 @@ int __ref cpci_configure_slot(struct slot *slot)
305 300
306int cpci_unconfigure_slot(struct slot* slot) 301int cpci_unconfigure_slot(struct slot* slot)
307{ 302{
308 int i; 303 struct pci_dev *dev, *temp;
309 struct pci_dev *dev;
310 304
311 dbg("%s - enter", __func__); 305 dbg("%s - enter", __func__);
312 if (!slot->dev) { 306 if (!slot->dev) {
@@ -314,13 +308,12 @@ int cpci_unconfigure_slot(struct slot* slot)
314 return -ENODEV; 308 return -ENODEV;
315 } 309 }
316 310
317 for (i = 0; i < 8; i++) { 311 list_for_each_entry_safe(dev, temp, &slot->bus->devices, bus_list) {
318 dev = pci_get_slot(slot->bus, 312 if (PCI_SLOT(dev->devfn) != PCI_SLOT(slot->devfn))
319 PCI_DEVFN(PCI_SLOT(slot->devfn), i)); 313 continue;
320 if (dev) { 314 pci_dev_get(dev);
321 pci_stop_and_remove_bus_device(dev); 315 pci_stop_and_remove_bus_device(dev);
322 pci_dev_put(dev); 316 pci_dev_put(dev);
323 }
324 } 317 }
325 pci_dev_put(slot->dev); 318 pci_dev_put(slot->dev);
326 slot->dev = NULL; 319 slot->dev = NULL;