qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT d29275f] Add exit callback to DeviceInfo.


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT d29275f] Add exit callback to DeviceInfo.
Date: Mon, 05 Oct 2009 14:53:26 -0000

From: Gerd Hoffmann <address@hidden>

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: Gerd Hoffmann <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/hw/qdev.c b/hw/qdev.c
index 7b204f9..064389d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -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);
diff --git a/hw/qdev.h b/hw/qdev.h
index cd58fa8..6c2c401 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -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;
 };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]