aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-08-26 17:40:03 -0400
committerBjorn Helgaas <bhelgaas@google.com>2013-08-26 17:40:03 -0400
commit1193725f543c92a77c73769bc2fbe48c53275f53 (patch)
tree71ef007260a1584f4f48d7a7118a3157d01eb5f7 /drivers/pci/pci.c
parent7d8c4a2c5ae6d76f1142fb052d698b3c40ce518c (diff)
parent39772038ea93e85ea4f1307ec9c1f48a063d89a0 (diff)
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 10e3c4e15178..d3fdce8f3d65 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1146,6 +1146,24 @@ int pci_reenable_device(struct pci_dev *dev)
1146 return 0; 1146 return 0;
1147} 1147}
1148 1148
1149static void pci_enable_bridge(struct pci_dev *dev)
1150{
1151 int retval;
1152
1153 if (!dev)
1154 return;
1155
1156 pci_enable_bridge(dev->bus->self);
1157
1158 if (pci_is_enabled(dev))
1159 return;
1160 retval = pci_enable_device(dev);
1161 if (retval)
1162 dev_err(&dev->dev, "Error enabling bridge (%d), continuing\n",
1163 retval);
1164 pci_set_master(dev);
1165}
1166
1149static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) 1167static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
1150{ 1168{
1151 int err; 1169 int err;
@@ -1166,6 +1184,8 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
1166 if (atomic_inc_return(&dev->enable_cnt) > 1) 1184 if (atomic_inc_return(&dev->enable_cnt) > 1)
1167 return 0; /* already enabled */ 1185 return 0; /* already enabled */
1168 1186
1187 pci_enable_bridge(dev->bus->self);
1188
1169 /* only skip sriov related */ 1189 /* only skip sriov related */
1170 for (i = 0; i <= PCI_ROM_RESOURCE; i++) 1190 for (i = 0; i <= PCI_ROM_RESOURCE; i++)
1171 if (dev->resource[i].flags & flags) 1191 if (dev->resource[i].flags & flags)