summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-08-26 15:40:03 -0600
committerBjorn Helgaas <bhelgaas@google.com>2013-08-26 15:40:03 -0600
commit1193725f543c92a77c73769bc2fbe48c53275f53 (patch)
tree71ef007260a1584f4f48d7a7118a3157d01eb5f7 /drivers/pci/pci.c
parent7d8c4a2c5ae6d76f1142fb052d698b3c40ce518c (diff)
parent39772038ea93e85ea4f1307ec9c1f48a063d89a0 (diff)
downloadop-kernel-dev-1193725f543c92a77c73769bc2fbe48c53275f53.zip
op-kernel-dev-1193725f543c92a77c73769bc2fbe48c53275f53.tar.gz
Merge branch 'pci/yinghai-assign-unassigned-v6' into next
* pci/yinghai-assign-unassigned-v6: PCI: Assign resources for hot-added host bridge more aggressively PCI: Move resource reallocation code to non-__init PCI: Delay enabling bridges until they're needed PCI: Assign resources on a per-bus basis PCI: Enable unassigned resource reallocation on per-bus basis PCI: Turn on reallocation for unassigned resources with host bridge offset PCI: Look for unassigned resources on per-bus basis PCI: Drop temporary variable in pci_assign_unassigned_resources()
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 10e3c4e..d3fdce8 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1146,6 +1146,24 @@ int pci_reenable_device(struct pci_dev *dev)
return 0;
}
+static void pci_enable_bridge(struct pci_dev *dev)
+{
+ int retval;
+
+ if (!dev)
+ return;
+
+ pci_enable_bridge(dev->bus->self);
+
+ if (pci_is_enabled(dev))
+ return;
+ retval = pci_enable_device(dev);
+ if (retval)
+ dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n",
+ retval);
+ pci_set_master(dev);
+}
+
static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
{
int err;
@@ -1166,6 +1184,8 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
if (atomic_inc_return(&dev->enable_cnt) > 1)
return 0; /* already enabled */
+ pci_enable_bridge(dev->bus->self);
+
/* only skip sriov related */
for (i = 0; i <= PCI_ROM_RESOURCE; i++)
if (dev->resource[i].flags & flags)
OpenPOWER on IntegriCloud