Message ID | 20170208224930.14351.91597.stgit@bhelgaas-glaptop.roam.corp.google.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On Wed, Feb 08, 2017 at 04:49:30PM -0600, Bjorn Helgaas wrote: > + list_for_each_entry(child, &bus->children, node) > + pcie_bus_configure_settings(child); This loop is duplicated in just about every driver, so it it might be a good idea to provide a littler helper for it.
On Wed, Feb 08, 2017 at 11:19:56PM -0800, Christoph Hellwig wrote: > On Wed, Feb 08, 2017 at 04:49:30PM -0600, Bjorn Helgaas wrote: > > + list_for_each_entry(child, &bus->children, node) > > + pcie_bus_configure_settings(child); > > This loop is duplicated in just about every driver, so it it > might be a good idea to provide a littler helper for it. Yeah, you're right. One reason I didn't is because I would like to remove these if we can move the MPS setup into the pci_device_add() path. We ought to be able to do at least the minimal "configure this new device to match the existing hierarchy; if that's impossible, disable the device" sort of thing there. We probably would still want some sort of bus- or root port- or host bridge-level configuration that can take a broader view, and that might be done where we currently have this loop. But I don't know exactly what that should look like. Bjorn
diff --git a/drivers/pci/host/pcie-xilinx.c b/drivers/pci/host/pcie-xilinx.c index c8616fadccf1..7f030f5d750b 100644 --- a/drivers/pci/host/pcie-xilinx.c +++ b/drivers/pci/host/pcie-xilinx.c @@ -632,7 +632,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct xilinx_pcie_port *port; - struct pci_bus *bus; + struct pci_bus *bus, *child; int err; resource_size_t iobase = 0; LIST_HEAD(res); @@ -686,6 +686,8 @@ static int xilinx_pcie_probe(struct platform_device *pdev) #ifndef CONFIG_MICROBLAZE pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); #endif + list_for_each_entry(child, &bus->children, node) + pcie_bus_configure_settings(child); pci_bus_add_devices(bus); return 0;