On Tue, Sep 25, 2012 at 10:29 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: > On Tue, Sep 25, 2012 at 9:23 AM, Bjorn Helgaas <bhelgaas@xxxxxxxxxx> wrote: >> On Tue, Sep 25, 2012 at 2:26 AM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote: >>> could remove pci_root_buses list. >>> > ... >>> PCI: Add dummy bus_type for pci_host_bridge > ... >>> PCI: Add for_each_pci_host_bridge() and pci_get_next_host_bridge >> >> I'm not thrilled about adding a new iterator for all host bridges. >> >> The iterator design pattern does not work for collections that can >> change over time. In this case, it looks like you're adding a safer >> way to iterate through all host bridges we know about at this time. >> But we still have the problem of the host bridge that's added >> tomorrow. >> >> I'd prefer a design where the PCI core provides an interface that >> means "call this function for every host bridge we know about now >> *and* for every one that's added in the future." > > yes, that is the point to add pci_root_bridge_bus_type. We can register > bus notifier on that. I guess I missed your point. In the patch below (20/29 from your series), you're still iterating through all the host bridges, so there would have to be something else to handle hot-added host bridges. Are you saying you plan future patches to change this again to something using a bus notifier? --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -997,11 +997,13 @@ static void __devinit pci_bus_slot_names(struct device_node *node, static int __init of_pci_slot_init(void) { - struct pci_bus *pbus = NULL; + struct pci_host_bridge *host_bridge = NULL; + struct pci_bus *pbus; - while ((pbus = pci_find_next_bus(pbus)) != NULL) { + for_each_pci_host_bridge(host_bridge) { struct device_node *node; + pbus = hot_bridge->bus; if (pbus->self) { /* PCI->PCI bridge */ node = pbus->self->dev.of_node; -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html