From f424d5c4c9de67b56594384eac3c08dc33de9344 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 27 Mar 2012 18:38:46 +0200 Subject: qdev: add children before qdev_init We want the composition tree to to be in order by the time we call qdev_init, so that a single set of the toplevel realize property can propagate all the way down the composition tree. This is not the case so far. Unfortunately, this is incompatible with calling qdev_init in the constructor wrappers for devices, so for now we need to unattach some devices that are created through those wrappers. This will be fixed by removing qdev_init and instead setting the toplevel realize property after machine init. Reviewed-by: Anthony Liguori Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- hw/piix_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'hw/piix_pci.c') diff --git a/hw/piix_pci.c b/hw/piix_pci.c index e0268fe053..9017565424 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -276,8 +276,8 @@ static PCIBus *i440fx_common_init(const char *device_name, b = pci_bus_new(&s->busdev.qdev, NULL, pci_address_space, address_space_io, 0); s->bus = b; - qdev_init_nofail(dev); object_property_add_child(object_get_root(), "i440fx", OBJECT(dev), NULL); + qdev_init_nofail(dev); d = pci_create_simple(b, 0, device_name); *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d); @@ -316,7 +316,6 @@ static PCIBus *i440fx_common_init(const char *device_name, pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, PIIX_NUM_PIRQS); } - object_property_add_child(OBJECT(dev), "piix3", OBJECT(piix3), NULL); piix3->pic = pic; *isa_bus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(&piix3->dev.qdev, "isa.0")); -- cgit 1.4.1