Signed-off-by: Markus Armbruster <arm...@redhat.com> --- hw/ide/internal.h | 1 + hw/ide/qdev.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/ide/internal.h b/hw/ide/internal.h index 12f80de..df8887a 100644 --- a/hw/ide/internal.h +++ b/hw/ide/internal.h @@ -527,6 +527,7 @@ typedef int (*ide_qdev_initfn)(IDEDevice *dev); struct IDEDeviceInfo { DeviceInfo qdev; ide_qdev_initfn init; + ide_qdev_initfn exit; }; #define BM_STATUS_DMAING 0x01 diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index d9b8f24..97ccbe8 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -87,9 +87,21 @@ err: return -1; } +static int ide_qdev_exit(DeviceState *qdev) +{ + IDEDevice *dev = DO_UPCAST(IDEDevice, qdev, qdev); + IDEDeviceInfo *info = DO_UPCAST(IDEDeviceInfo, qdev, qdev->info); + + if (info->exit) { + return info->exit(dev); + } + return 0; +} + static void ide_qdev_register(IDEDeviceInfo *info) { info->qdev.init = ide_qdev_init; + info->qdev.exit = ide_qdev_exit; info->qdev.bus_info = &ide_bus_info; qdev_register(&info->qdev); } -- 1.7.2.3