mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
qdev: integrate reset
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
7fc2f2c086
commit
959f733a29
2 changed files with 13 additions and 1 deletions
11
hw/qdev.c
11
hw/qdev.c
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -108,6 +108,9 @@ struct DeviceInfo {
|
|||
Property *props;
|
||||
int no_user;
|
||||
|
||||
/* callbacks */
|
||||
QEMUResetHandler *reset;
|
||||
|
||||
/* Private to qdev / bus. */
|
||||
qdev_initfn init;
|
||||
BusInfo *bus_info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue