On Mon, Aug 6, 2012 at 7:29 PM, Peter Maydell <peter.mayd...@linaro.org> wrote: > On 6 August 2012 03:16, Peter A. G. Crosthwaite > <peter.crosthwa...@petalogix.com> wrote: >> Slave creation function that can be used to create an SSI slave without >> qdev_init() being called. This give machine models a change to set >> properties. > > Not convinced about this one -- I think that if machine models need to > do more complicated things with the qdev device then they should just > call qdev_create/set properties/qdev_init themselves. >
Yeh I tried that didnt work. See comment below. > -- PMM > >> Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwa...@petalogix.com> >> --- >> hw/ssi.c | 9 +++++++-- >> hw/ssi.h | 1 + >> 2 files changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/hw/ssi.c b/hw/ssi.c >> index 2e4f2fe..c47419d 100644 >> --- a/hw/ssi.c >> +++ b/hw/ssi.c >> @@ -86,10 +86,15 @@ static TypeInfo ssi_slave_info = { >> .abstract = true, >> }; >> >> +DeviceState *ssi_create_slave_no_init(SSIBus *bus, const char *name) >> +{ >> + return qdev_create(&bus->qbus, name); bus->qbus accesses requires the definition of struct SSIBus which is private to ssi.c. Machine models cant access the qbus field which they need for qdev_create(). Regards, Peter >> +} >> + >> DeviceState *ssi_create_slave(SSIBus *bus, const char *name) >> { >> - DeviceState *dev; >> - dev = qdev_create(&bus->qbus, name); >> + DeviceState *dev = ssi_create_slave_no_init(bus, name); >> + >> qdev_init_nofail(dev); >> return dev; >> } >> diff --git a/hw/ssi.h b/hw/ssi.h >> index 5b69a3b..80b9664 100644 >> --- a/hw/ssi.h >> +++ b/hw/ssi.h >> @@ -76,6 +76,7 @@ extern const VMStateDescription vmstate_ssi_slave; >> } >> >> DeviceState *ssi_create_slave(SSIBus *bus, const char *name); >> +DeviceState *ssi_create_slave_no_init(SSIBus *bus, const char *name); >> >> /* Master interface. */ >> SSIBus *ssi_create_bus(DeviceState *parent, const char *name); >> -- >> 1.7.0.4 >>