提交 d29275f1 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

Add exit callback to DeviceInfo.

This adds a exit callback for device destruction to DeviceInfo, so
we can hook cleanups into qdev device destruction.

Followup patches will put that into use.
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 131ec1bd
......@@ -245,6 +245,8 @@ void qdev_free(DeviceState *dev)
#endif
if (dev->info->reset)
qemu_unregister_reset(dev->info->reset, dev);
if (dev->info->exit)
dev->info->exit(dev);
}
QLIST_REMOVE(dev, sibling);
qemu_free(dev);
......
......@@ -108,6 +108,7 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
/*** Device API. ***/
typedef int (*qdev_initfn)(DeviceState *dev, DeviceInfo *info);
typedef int (*qdev_exitfn)(DeviceState *dev);
struct DeviceInfo {
const char *name;
......@@ -125,6 +126,7 @@ struct DeviceInfo {
/* Private to qdev / bus. */
qdev_initfn init;
qdev_exitfn exit;
BusInfo *bus_info;
struct DeviceInfo *next;
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册