diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-09-01 09:56:12 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-09 14:57:20 -0500 |
commit | 959f733a296a69564a075d60d8c821ad8e258623 (patch) | |
tree | e261867939613c7f7b4887f710bb9a50836e1b92 /hw/qdev.c | |
parent | 7fc2f2c0869f68eaa42446e5a394d79bb7c9f7f7 (diff) | |
download | qemu-959f733a296a69564a075d60d8c821ad8e258623.zip qemu-959f733a296a69564a075d60d8c821ad8e258623.tar.gz qemu-959f733a296a69564a075d60d8c821ad8e258623.tar.bz2 |
qdev: integrate reset
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -214,12 +214,21 @@ DeviceState *qdev_device_add(QemuOpts *opts) calling this function. */ int qdev_init(DeviceState *dev) { - return dev->info->init(dev, dev->info); + int rc; + + rc = dev->info->init(dev, dev->info); + if (rc < 0) + return rc; + if (dev->info->reset) + qemu_register_reset(dev->info->reset, dev); + return 0; } /* Unlink device from bus and free the structure. */ void qdev_free(DeviceState *dev) { + if (dev->info->reset) + qemu_unregister_reset(dev->info->reset, dev); LIST_REMOVE(dev, sibling); qemu_free(dev); } |