On Friday 02 May 2014 13:03:18 Jason Gunthorpe wrote: > > > > Setup is called from probe, through pci_common_init_dev(), so that shouldn't > > > make a difference. > > > > Given that the idea was to separate setup() and probe(), I didn't want to > > make the assumption that I was called in probe context. > > IMHO, we need to have clear purposes for setup() and probe(). > > Probe is well defined already, it requests resources, claims the > device, puts it in reset and then does some subsystem specific thing. > The interaction with probe and devm is also already well specified. > > It doesn't matter for this driver, but look at mvebu, you cannot move > the interrupt, gpio and clock acquisitions from probe() to setup(), as > they could all trigger a defered probe. Better to be consistent, > especially if this is the golden reference driver we want everyone to > follow (sorry Will) Fair enough. It shouldn't be hard to move. > To me setup() is more like netdev open(), so it should just do that > final step to enable the links and bring up the PCI network and be > ready to run PCI discovery. Consider, someday we might have an > unsetup() for power mangement reasons, just like we have a close() in > netdev. I expect setup() to just go away in the long run for loadable host controllers, and get merged into probe(). > If the long term plan is to keep probe() then I don't think it makes > sense to move probe() duties into setup(). That just restricts what we > can do with the setup() call if setup() is now required to always > handle defered probe and so forth. setup() makes sense for the traditional ARM32 PCI support with nr_controllers > 1: dove, kirkwood, mv78xx0, orion5x and iop13xx (most of these are gradually getting replace with pci-mvebu.c, which doesn't do that, as you know). All other classic drivers only support one host bridge anyway, and the loadable driver just use one domain per host bridge, which means you lose all the advantages of having pci_common_init_dev() assign the bus numbers and call setup functions for each host bridge. It should be fine to have a trivial setup function like this static int gen_pci_setup(int nr, struct pci_sys_data *sys) { struct gen_pci *pci = sys->private_data; list_splice_init(pci->resource, sys->resources); return 1; } and do everything in probe(). Arnd -- 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