diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2009-09-16 13:40:27 +0300 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-10-05 09:32:50 -0500 |
commit | 7f23f812c49da6d6fe03bcd4bc2d07341e93db11 (patch) | |
tree | 68577e6d08641474f5dd3ea919e343b68eb14fe1 /hw/qdev.c | |
parent | ac0be998009257f0368e25470bac4e85b694ceaf (diff) | |
download | qemu-7f23f812c49da6d6fe03bcd4bc2d07341e93db11.zip qemu-7f23f812c49da6d6fe03bcd4bc2d07341e93db11.tar.gz qemu-7f23f812c49da6d6fe03bcd4bc2d07341e93db11.tar.bz2 |
qemu/qdev: type safety in reset handler
Add type safety to qdev reset handlers, by declaring them as
DeviceState * rather than void *.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r-- | hw/qdev.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -222,6 +222,13 @@ DeviceState *qdev_device_add(QemuOpts *opts) return qdev; } +static void qdev_reset(void *opaque) +{ + DeviceState *dev = opaque; + if (dev->info->reset) + dev->info->reset(dev); +} + /* Initialize a device. Device properties should be set before calling this function. IRQs and MMIO regions should be connected/mapped after calling this function. */ @@ -233,8 +240,7 @@ int qdev_init(DeviceState *dev) rc = dev->info->init(dev, dev->info); if (rc < 0) return rc; - if (dev->info->reset) - qemu_register_reset(dev->info->reset, dev); + qemu_register_reset(qdev_reset, dev); if (dev->info->vmsd) vmstate_register(-1, dev->info->vmsd, dev); dev->state = DEV_STATE_INITIALIZED; @@ -273,13 +279,12 @@ void qdev_free(DeviceState *dev) if (dev->info->vmsd) vmstate_unregister(dev->info->vmsd, dev); #endif - if (dev->info->reset) - qemu_unregister_reset(dev->info->reset, dev); if (dev->info->exit) dev->info->exit(dev); if (dev->opts) qemu_opts_del(dev->opts); } + qemu_unregister_reset(qdev_reset, dev); QLIST_REMOVE(dev, sibling); qemu_free(dev); } |