aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/display/virtio-gpu-pci.c3
-rw-r--r--hw/display/virtio-vga.c3
-rw-r--r--hw/i386/amd_iommu.c3
-rw-r--r--hw/isa/piix4.c3
-rw-r--r--hw/misc/macio/macio.c7
-rw-r--r--hw/pci-host/designware.c3
-rw-r--r--hw/pci-host/gpex.c3
-rw-r--r--hw/pci-host/pnv_phb3.c3
-rw-r--r--hw/pci-host/pnv_phb4.c3
-rw-r--r--hw/pci-host/q35.c3
-rw-r--r--hw/pci-host/versatile.c3
-rw-r--r--hw/pci-host/xilinx-pcie.c3
-rw-r--r--hw/s390x/vhost-vsock-ccw.c3
-rw-r--r--hw/s390x/virtio-ccw-9p.c3
-rw-r--r--hw/s390x/virtio-ccw-balloon.c3
-rw-r--r--hw/s390x/virtio-ccw-blk.c3
-rw-r--r--hw/s390x/virtio-ccw-crypto.c3
-rw-r--r--hw/s390x/virtio-ccw-gpu.c3
-rw-r--r--hw/s390x/virtio-ccw-input.c3
-rw-r--r--hw/s390x/virtio-ccw-net.c3
-rw-r--r--hw/s390x/virtio-ccw-rng.c3
-rw-r--r--hw/s390x/virtio-ccw-scsi.c6
-rw-r--r--hw/s390x/virtio-ccw-serial.c3
-rw-r--r--hw/virtio/vhost-scsi-pci.c3
-rw-r--r--hw/virtio/vhost-user-blk-pci.c3
-rw-r--r--hw/virtio/vhost-user-fs-pci.c3
-rw-r--r--hw/virtio/vhost-user-scsi-pci.c3
-rw-r--r--hw/virtio/vhost-user-vsock-pci.c3
-rw-r--r--hw/virtio/vhost-vsock-pci.c3
-rw-r--r--hw/virtio/virtio-9p-pci.c3
-rw-r--r--hw/virtio/virtio-balloon-pci.c3
-rw-r--r--hw/virtio/virtio-blk-pci.c3
-rw-r--r--hw/virtio/virtio-crypto-pci.c3
-rw-r--r--hw/virtio/virtio-input-pci.c3
-rw-r--r--hw/virtio/virtio-iommu-pci.c3
-rw-r--r--hw/virtio/virtio-net-pci.c3
-rw-r--r--hw/virtio/virtio-pmem-pci.c3
-rw-r--r--hw/virtio/virtio-rng-pci.c3
-rw-r--r--hw/virtio/virtio-scsi-pci.c3
-rw-r--r--hw/virtio/virtio-serial-pci.c3
-rw-r--r--hw/xen/xen-legacy-backend.c3
41 files changed, 43 insertions, 87 deletions
diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index 3d152ff..b532fe8 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -33,9 +33,8 @@ static void virtio_gpu_pci_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
int i;
Error *local_error = NULL;
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
virtio_pci_force_virtio_1(vpci_dev);
- object_property_set_bool(OBJECT(vdev), true, "realized", &local_error);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), &local_error);
if (local_error) {
error_propagate(errp, local_error);
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index 95757a6..68a062e 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -137,9 +137,8 @@ static void virtio_vga_base_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->common.offset = offset;
/* init virtio bits */
- qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus));
virtio_pci_force_virtio_1(vpci_dev);
- object_property_set_bool(OBJECT(g), true, "realized", &err);
+ qdev_realize(DEVICE(g), BUS(&vpci_dev->bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 4346060..b26d30d 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1549,8 +1549,7 @@ static void amdvi_realize(DeviceState *dev, Error **errp)
/* This device should take care of IOMMU PCI properties */
x86_iommu->type = TYPE_AMD;
- qdev_set_parent_bus(DEVICE(&s->pci), &bus->qbus);
- object_property_set_bool(OBJECT(&s->pci), true, "realized", errp);
+ qdev_realize(DEVICE(&s->pci), &bus->qbus, errp);
ret = pci_add_capability(&s->pci.dev, AMDVI_CAPAB_ID_SEC, 0,
AMDVI_CAPAB_SIZE, errp);
if (ret < 0) {
diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
index 9a10fb9..f634bcb 100644
--- a/hw/isa/piix4.c
+++ b/hw/isa/piix4.c
@@ -182,9 +182,8 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
i8257_dma_init(isa_bus, 0);
/* RTC */
- qdev_set_parent_bus(DEVICE(&s->rtc), BUS(isa_bus));
qdev_prop_set_int32(DEVICE(&s->rtc), "base_year", 2000);
- object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err);
+ qdev_realize(DEVICE(&s->rtc), BUS(isa_bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 53a9fd5..216bdc6 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -356,9 +356,7 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
object_property_set_link(OBJECT(&s->pmu), OBJECT(sysbus_dev), "gpio",
&error_abort);
qdev_prop_set_bit(DEVICE(&s->pmu), "has-adb", ns->has_adb);
- qdev_set_parent_bus(DEVICE(&s->pmu), BUS(&s->macio_bus));
-
- object_property_set_bool(OBJECT(&s->pmu), true, "realized", &err);
+ qdev_realize(DEVICE(&s->pmu), BUS(&s->macio_bus), &err);
if (err) {
error_propagate(errp, err);
return;
@@ -374,11 +372,10 @@ static void macio_newworld_realize(PCIDevice *d, Error **errp)
/* CUDA */
object_initialize_child(OBJECT(s), "cuda", &s->cuda, sizeof(s->cuda),
TYPE_CUDA, &error_abort, NULL);
- qdev_set_parent_bus(DEVICE(&s->cuda), BUS(&s->macio_bus));
qdev_prop_set_uint64(DEVICE(&s->cuda), "timebase-frequency",
s->frequency);
- object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err);
+ qdev_realize(DEVICE(&s->cuda), BUS(&s->macio_bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
index dd24551..2e97d6b 100644
--- a/hw/pci-host/designware.c
+++ b/hw/pci-host/designware.c
@@ -688,8 +688,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
"pcie-bus-address-space");
pci_setup_iommu(pci->bus, designware_pcie_host_set_iommu, s);
- qdev_set_parent_bus(DEVICE(&s->root), BUS(pci->bus));
- qdev_init_nofail(DEVICE(&s->root));
+ qdev_realize(DEVICE(&s->root), BUS(pci->bus), &error_fatal);
}
static const VMStateDescription vmstate_designware_pcie_host = {
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index 0ca604d..3dfb3bf 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -98,9 +98,8 @@ static void gpex_host_realize(DeviceState *dev, Error **errp)
pci_swizzle_map_irq_fn, s, &s->io_mmio,
&s->io_ioport, 0, 4, TYPE_PCIE_BUS);
- qdev_set_parent_bus(DEVICE(&s->gpex_root), BUS(pci->bus));
pci_bus_set_route_irq_fn(pci->bus, gpex_route_intx_pin_to_irq);
- qdev_init_nofail(DEVICE(&s->gpex_root));
+ qdev_realize(DEVICE(&s->gpex_root), BUS(pci->bus), &error_fatal);
}
static const char *gpex_host_root_bus_path(PCIHostState *host_bridge,
diff --git a/hw/pci-host/pnv_phb3.c b/hw/pci-host/pnv_phb3.c
index 74618fa..8dcfe4a 100644
--- a/hw/pci-host/pnv_phb3.c
+++ b/hw/pci-host/pnv_phb3.c
@@ -1064,8 +1064,7 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
/* Add a single Root port */
qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
- qdev_set_parent_bus(DEVICE(&phb->root), BUS(pci->bus));
- qdev_init_nofail(DEVICE(&phb->root));
+ qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
}
void pnv_phb3_update_regions(PnvPHB3 *phb)
diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
index 23cf093..e30ae9a 100644
--- a/hw/pci-host/pnv_phb4.c
+++ b/hw/pci-host/pnv_phb4.c
@@ -1210,8 +1210,7 @@ static void pnv_phb4_realize(DeviceState *dev, Error **errp)
/* Add a single Root port */
qdev_prop_set_uint8(DEVICE(&phb->root), "chassis", phb->chip_id);
qdev_prop_set_uint16(DEVICE(&phb->root), "slot", phb->phb_id);
- qdev_set_parent_bus(DEVICE(&phb->root), BUS(pci->bus));
- qdev_init_nofail(DEVICE(&phb->root));
+ qdev_realize(DEVICE(&phb->root), BUS(pci->bus), &error_fatal);
/* Setup XIVE Source */
if (phb->big_phb) {
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index b788f17..43ed518 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -64,8 +64,7 @@ static void q35_host_realize(DeviceState *dev, Error **errp)
s->mch.address_space_io,
0, TYPE_PCIE_BUS);
PC_MACHINE(qdev_get_machine())->bus = pci->bus;
- qdev_set_parent_bus(DEVICE(&s->mch), BUS(pci->bus));
- qdev_init_nofail(DEVICE(&s->mch));
+ qdev_realize(DEVICE(&s->mch), BUS(pci->bus), &error_fatal);
}
static const char *q35_host_root_bus_path(PCIHostState *host_bridge,
diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c
index ea7390c..616882a 100644
--- a/hw/pci-host/versatile.c
+++ b/hw/pci-host/versatile.c
@@ -409,7 +409,6 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)
h->bus = &s->pci_bus;
object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_HOST);
- qdev_set_parent_bus(DEVICE(&s->pci_dev), BUS(&s->pci_bus));
for (i = 0; i < 4; i++) {
sysbus_init_irq(sbd, &s->irq[i]);
@@ -459,7 +458,7 @@ static void pci_vpb_realize(DeviceState *dev, Error **errp)
}
/* TODO Remove once realize propagates to child devices. */
- object_property_set_bool(OBJECT(&s->pci_dev), true, "realized", errp);
+ qdev_realize(DEVICE(&s->pci_dev), BUS(&s->pci_bus), errp);
}
static void versatile_pci_host_realize(PCIDevice *d, Error **errp)
diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index e06f2b5..e4fc8ab 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -137,8 +137,7 @@ static void xilinx_pcie_host_realize(DeviceState *dev, Error **errp)
pci_swizzle_map_irq_fn, s, &s->mmio,
&s->io, 0, 4, TYPE_PCIE_BUS);
- qdev_set_parent_bus(DEVICE(&s->root), BUS(pci->bus));
- qdev_init_nofail(DEVICE(&s->root));
+ qdev_realize(DEVICE(&s->root), BUS(pci->bus), &error_fatal);
}
static const char *xilinx_pcie_host_root_bus_path(PCIHostState *host_bridge,
diff --git a/hw/s390x/vhost-vsock-ccw.c b/hw/s390x/vhost-vsock-ccw.c
index 12dee15..0822ecc 100644
--- a/hw/s390x/vhost-vsock-ccw.c
+++ b/hw/s390x/vhost-vsock-ccw.c
@@ -24,8 +24,7 @@ static void vhost_vsock_ccw_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VHostVSockCCWState *dev = VHOST_VSOCK_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void vhost_vsock_ccw_class_init(ObjectClass *klass, void *data)
diff --git a/hw/s390x/virtio-ccw-9p.c b/hw/s390x/virtio-ccw-9p.c
index 08e1d5d..88c8884 100644
--- a/hw/s390x/virtio-ccw-9p.c
+++ b/hw/s390x/virtio-ccw-9p.c
@@ -21,8 +21,7 @@ static void virtio_ccw_9p_realize(VirtioCcwDevice *ccw_dev, Error **errp)
V9fsCCWState *dev = VIRTIO_9P_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_9p_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-balloon.c b/hw/s390x/virtio-ccw-balloon.c
index ef3308e..4c7631a 100644
--- a/hw/s390x/virtio-ccw-balloon.c
+++ b/hw/s390x/virtio-ccw-balloon.c
@@ -21,8 +21,7 @@ static void virtio_ccw_balloon_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtIOBalloonCcw *dev = VIRTIO_BALLOON_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_balloon_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-blk.c b/hw/s390x/virtio-ccw-blk.c
index 7287932..2294ce1 100644
--- a/hw/s390x/virtio-ccw-blk.c
+++ b/hw/s390x/virtio-ccw-blk.c
@@ -21,8 +21,7 @@ static void virtio_ccw_blk_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtIOBlkCcw *dev = VIRTIO_BLK_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_blk_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-crypto.c b/hw/s390x/virtio-ccw-crypto.c
index 1a2690c..ca6753b 100644
--- a/hw/s390x/virtio-ccw-crypto.c
+++ b/hw/s390x/virtio-ccw-crypto.c
@@ -21,8 +21,7 @@ static void virtio_ccw_crypto_realize(VirtioCcwDevice *ccw_dev, Error **errp)
DeviceState *vdev = DEVICE(&dev->vdev);
Error *err = NULL;
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c
index f69e3ff..c301e25 100644
--- a/hw/s390x/virtio-ccw-gpu.c
+++ b/hw/s390x/virtio-ccw-gpu.c
@@ -20,8 +20,7 @@ static void virtio_ccw_gpu_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtIOGPUCcw *dev = VIRTIO_GPU_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_gpu_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-input.c b/hw/s390x/virtio-ccw-input.c
index b257dfd..5601e25 100644
--- a/hw/s390x/virtio-ccw-input.c
+++ b/hw/s390x/virtio-ccw-input.c
@@ -20,8 +20,7 @@ static void virtio_ccw_input_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VirtIOInputCcw *dev = VIRTIO_INPUT_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static Property virtio_ccw_input_properties[] = {
diff --git a/hw/s390x/virtio-ccw-net.c b/hw/s390x/virtio-ccw-net.c
index 26c4d87..3860d4e 100644
--- a/hw/s390x/virtio-ccw-net.c
+++ b/hw/s390x/virtio-ccw-net.c
@@ -24,8 +24,7 @@ static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp)
virtio_net_set_netclient_name(&dev->vdev, qdev->id,
object_get_typename(OBJECT(qdev)));
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_net_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-rng.c b/hw/s390x/virtio-ccw-rng.c
index d575e30..4077160 100644
--- a/hw/s390x/virtio-ccw-rng.c
+++ b/hw/s390x/virtio-ccw-rng.c
@@ -22,8 +22,7 @@ static void virtio_ccw_rng_realize(VirtioCcwDevice *ccw_dev, Error **errp)
DeviceState *vdev = DEVICE(&dev->vdev);
Error *err = NULL;
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/s390x/virtio-ccw-scsi.c b/hw/s390x/virtio-ccw-scsi.c
index 3cb3ad6..6e4beef 100644
--- a/hw/s390x/virtio-ccw-scsi.c
+++ b/hw/s390x/virtio-ccw-scsi.c
@@ -33,8 +33,7 @@ static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
g_free(bus_name);
}
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void virtio_ccw_scsi_instance_init(Object *obj)
@@ -78,8 +77,7 @@ static void vhost_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp)
VHostSCSICcw *dev = VHOST_SCSI_CCW(ccw_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
static void vhost_ccw_scsi_instance_init(Object *obj)
diff --git a/hw/s390x/virtio-ccw-serial.c b/hw/s390x/virtio-ccw-serial.c
index 1764db2..6195822 100644
--- a/hw/s390x/virtio-ccw-serial.c
+++ b/hw/s390x/virtio-ccw-serial.c
@@ -33,8 +33,7 @@ static void virtio_ccw_serial_realize(VirtioCcwDevice *ccw_dev, Error **errp)
g_free(bus_name);
}
- qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&ccw_dev->bus), errp);
}
diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c
index 5da6bb6..095af23 100644
--- a/hw/virtio/vhost-scsi-pci.c
+++ b/hw/virtio/vhost-scsi-pci.c
@@ -53,8 +53,7 @@ static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->nvectors = vs->conf.num_queues + 3;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_scsi_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/vhost-user-blk-pci.c b/hw/virtio/vhost-user-blk-pci.c
index 58d7c31..4f5d5cb 100644
--- a/hw/virtio/vhost-user-blk-pci.c
+++ b/hw/virtio/vhost-user-blk-pci.c
@@ -58,8 +58,7 @@ static void vhost_user_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->nvectors = dev->vdev.num_queues + 1;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_user_blk_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/vhost-user-fs-pci.c b/hw/virtio/vhost-user-fs-pci.c
index ae36f11..e11c889 100644
--- a/hw/virtio/vhost-user-fs-pci.c
+++ b/hw/virtio/vhost-user-fs-pci.c
@@ -44,8 +44,7 @@ static void vhost_user_fs_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->nvectors = dev->vdev.conf.num_request_queues + 2;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_user_fs_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pci.c
index 6f3375f..4705cd5 100644
--- a/hw/virtio/vhost-user-scsi-pci.c
+++ b/hw/virtio/vhost-user-scsi-pci.c
@@ -59,8 +59,7 @@ static void vhost_user_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->nvectors = vs->conf.num_queues + 3;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_user_scsi_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/vhost-user-vsock-pci.c b/hw/virtio/vhost-user-vsock-pci.c
index 0a6847e..f4cf958 100644
--- a/hw/virtio/vhost-user-vsock-pci.c
+++ b/hw/virtio/vhost-user-vsock-pci.c
@@ -40,8 +40,7 @@ static void vhost_user_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VHostUserVSockPCI *dev = VHOST_USER_VSOCK_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_user_vsock_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/vhost-vsock-pci.c b/hw/virtio/vhost-vsock-pci.c
index 01effe3..a815278 100644
--- a/hw/virtio/vhost-vsock-pci.c
+++ b/hw/virtio/vhost-vsock-pci.c
@@ -44,8 +44,7 @@ static void vhost_vsock_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VHostVSockPCI *dev = VHOST_VSOCK_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void vhost_vsock_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-9p-pci.c b/hw/virtio/virtio-9p-pci.c
index 6507ce3..cbcb062 100644
--- a/hw/virtio/virtio-9p-pci.c
+++ b/hw/virtio/virtio-9p-pci.c
@@ -38,8 +38,7 @@ static void virtio_9p_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
V9fsPCIState *dev = VIRTIO_9P_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static Property virtio_9p_pci_properties[] = {
diff --git a/hw/virtio/virtio-balloon-pci.c b/hw/virtio/virtio-balloon-pci.c
index cc25df0..5adc4e5 100644
--- a/hw/virtio/virtio-balloon-pci.c
+++ b/hw/virtio/virtio-balloon-pci.c
@@ -48,8 +48,7 @@ static void virtio_balloon_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->class_code = PCI_CLASS_OTHERS;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_balloon_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-blk-pci.c b/hw/virtio/virtio-blk-pci.c
index 28838fa..849cc7d 100644
--- a/hw/virtio/virtio-blk-pci.c
+++ b/hw/virtio/virtio-blk-pci.c
@@ -55,8 +55,7 @@ static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
vpci_dev->nvectors = dev->vdev.conf.num_queues + 1;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_blk_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-crypto-pci.c b/hw/virtio/virtio-crypto-pci.c
index 0bebe01..72be531 100644
--- a/hw/virtio/virtio-crypto-pci.c
+++ b/hw/virtio/virtio-crypto-pci.c
@@ -53,9 +53,8 @@ static void virtio_crypto_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
return;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
virtio_pci_force_virtio_1(vpci_dev);
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
object_property_set_link(OBJECT(vcrypto),
OBJECT(vcrypto->vdev.conf.cryptodev), "cryptodev",
NULL);
diff --git a/hw/virtio/virtio-input-pci.c b/hw/virtio/virtio-input-pci.c
index 5a96540..74651a4 100644
--- a/hw/virtio/virtio-input-pci.c
+++ b/hw/virtio/virtio-input-pci.c
@@ -49,9 +49,8 @@ static void virtio_input_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOInputPCI *vinput = VIRTIO_INPUT_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&vinput->vdev);
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
virtio_pci_force_virtio_1(vpci_dev);
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_input_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c
index 3dfbf55..632533a 100644
--- a/hw/virtio/virtio-iommu-pci.c
+++ b/hw/virtio/virtio-iommu-pci.c
@@ -54,11 +54,10 @@ static void virtio_iommu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
"-no-acpi\n");
return;
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
object_property_set_link(OBJECT(dev),
OBJECT(pci_get_bus(&vpci_dev->pci_dev)),
"primary-bus", errp);
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_iommu_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-net-pci.c b/hw/virtio/virtio-net-pci.c
index ea43040..489b5db 100644
--- a/hw/virtio/virtio-net-pci.c
+++ b/hw/virtio/virtio-net-pci.c
@@ -52,8 +52,7 @@ static void virtio_net_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
virtio_net_set_netclient_name(&dev->vdev, qdev->id,
object_get_typename(OBJECT(qdev)));
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_net_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-pmem-pci.c b/hw/virtio/virtio-pmem-pci.c
index fe2af00..11d0c8e 100644
--- a/hw/virtio/virtio-pmem-pci.c
+++ b/hw/virtio/virtio-pmem-pci.c
@@ -22,8 +22,7 @@ static void virtio_pmem_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOPMEMPCI *pmem_pci = VIRTIO_PMEM_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&pmem_pci->vdev);
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_pmem_pci_set_addr(MemoryDeviceState *md, uint64_t addr,
diff --git a/hw/virtio/virtio-rng-pci.c b/hw/virtio/virtio-rng-pci.c
index 8aaf54b..cf1afb4 100644
--- a/hw/virtio/virtio-rng-pci.c
+++ b/hw/virtio/virtio-rng-pci.c
@@ -36,8 +36,7 @@ static void virtio_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
DeviceState *vdev = DEVICE(&vrng->vdev);
Error *err = NULL;
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", &err);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), &err);
if (err) {
error_propagate(errp, err);
return;
diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c
index e82e7e5..c23a134 100644
--- a/hw/virtio/virtio-scsi-pci.c
+++ b/hw/virtio/virtio-scsi-pci.c
@@ -64,8 +64,7 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
g_free(bus_name);
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static void virtio_scsi_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/virtio/virtio-serial-pci.c b/hw/virtio/virtio-serial-pci.c
index 22ab4d8..95d25d5 100644
--- a/hw/virtio/virtio-serial-pci.c
+++ b/hw/virtio/virtio-serial-pci.c
@@ -65,8 +65,7 @@ static void virtio_serial_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
g_free(bus_name);
}
- qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
- object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+ qdev_realize(vdev, BUS(&vpci_dev->bus), errp);
}
static Property virtio_serial_pci_properties[] = {
diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
index 1c25373..ef7c832 100644
--- a/hw/xen/xen-legacy-backend.c
+++ b/hw/xen/xen-legacy-backend.c
@@ -278,9 +278,8 @@ static struct XenLegacyDevice *xen_be_get_xendev(const char *type, int dom,
xendev = g_malloc0(ops->size);
object_initialize(&xendev->qdev, ops->size, TYPE_XENBACKEND);
OBJECT(xendev)->free = g_free;
- qdev_set_parent_bus(DEVICE(xendev), xen_sysbus);
qdev_set_id(DEVICE(xendev), g_strdup_printf("xen-%s-%d", type, dev));
- qdev_init_nofail(DEVICE(xendev));
+ qdev_realize(DEVICE(xendev), xen_sysbus, &error_fatal);
object_unref(OBJECT(xendev));
xendev->type = type;