Il 13/04/2012 09:30, Peter Maydell ha scritto: > ...but it's not uncommon for the number of memory regions or > IRQs to depend on some qdev property, so you can't put these > calls in instance_init, that would be too early.
Do you have examples? The only example I can find in the tree from a quick grep is the OMAP modulecount. >> Similarly, there is no reason why qdev_get_gpio_in can only be called >> after qdev_init_nofail. It's only like that because qdev_init_gpio_in >> is called later than in the instance_init function. Only a handful of >> devices need a dynamic number of GPIO pins, everything else can call it >> in instance_init. > > I think a model that says "half our devices set up memory and > IRQs in one function and the other half do it somewhere else" > is pretty confusing. I'd rather have a single standard place > where they can all set these up. I don't think this is any different from "half our devices use #defines and half our devices use qdev properties". Children can be created in initialization or creates children, and realization Paolo