Am 14.01.2013 21:36, schrieb KONRAD Frédéric: > On 14/01/2013 20:08, Anthony Liguori wrote: >> fred.kon...@greensocs.com writes: >> >>> +VirtioBusState *virtio_pci_bus_new(VirtIOPCIProxy *dev) >>> +{ >>> + DeviceState *qdev = DEVICE(dev); >>> + BusState *qbus = qbus_create(TYPE_VIRTIO_PCI_BUS, qdev, NULL); >>> + VirtioBusState *bus = VIRTIO_BUS(qbus); >>> + qbus->allow_hotplug = 0; >> Any reason to not use a qbus_create_inplace()? >> >> Regards, >> >> Anthony Liguori > If I change the bus field of VirtIOPCIProxy from VirtioBus* to VirtioBus > and I use qbus_create_inplace > I can't use qbus_create_inplace(BUS(&dev->bus),...) as the object is not > initialised yet right?
Correct, you need to use qbus_create_inplace((BusState *)&dev->bus,...). I ran into the same trap for ADB last night. ;) Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg