summary refs log tree commit diff stats
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:35 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:48 -0500
commitd29275f10382844e000ddaafaddc6780555e8d83 (patch)
tree48038e49e6c211226a7dfaab7f349ebf4ecf0d23 /hw
parent131ec1bd7de661f20f178f582430a9d0d0cfa9b4 (diff)
downloadfocaccia-qemu-d29275f10382844e000ddaafaddc6780555e8d83.tar.gz
focaccia-qemu-d29275f10382844e000ddaafaddc6780555e8d83.zip
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: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev.c2
-rw-r--r--hw/qdev.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 7b204f9517..064389dcd0 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 cd58fa8cf4..6c2c4013d2 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;
 };