diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-27 18:38:46 +0200 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-04-02 15:04:15 -0500 |
| commit | f424d5c4c9de67b56594384eac3c08dc33de9344 (patch) | |
| tree | 0559a455e18c7b0cd342c33e11474702685dca1e /hw/qdev-monitor.c | |
| parent | a612b2a6635fa1a3a29a8bcf41b31f1f3fae1110 (diff) | |
| download | focaccia-qemu-f424d5c4c9de67b56594384eac3c08dc33de9344.tar.gz focaccia-qemu-f424d5c4c9de67b56594384eac3c08dc33de9344.zip | |
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 <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev-monitor.c')
| -rw-r--r-- | hw/qdev-monitor.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c index 2e82962fc3..031cb83e1a 100644 --- a/hw/qdev-monitor.c +++ b/hw/qdev-monitor.c @@ -458,10 +458,6 @@ DeviceState *qdev_device_add(QemuOpts *opts) qdev_free(qdev); return NULL; } - if (qdev_init(qdev) < 0) { - qerror_report(QERR_DEVICE_INIT_FAILED, driver); - return NULL; - } if (qdev->id) { object_property_add_child(qdev_get_peripheral(), qdev->id, OBJECT(qdev), NULL); @@ -472,6 +468,10 @@ DeviceState *qdev_device_add(QemuOpts *opts) OBJECT(qdev), NULL); g_free(name); } + if (qdev_init(qdev) < 0) { + qerror_report(QERR_DEVICE_INIT_FAILED, driver); + return NULL; + } qdev->opts = opts; return qdev; } |