summaryrefslogtreecommitdiff
path: root/hw/qdev.h
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:34 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:48 -0500
commit131ec1bd7de661f20f178f582430a9d0d0cfa9b4 (patch)
tree4521969fd791e1c1e1822426de656ea4ecb2b391 /hw/qdev.h
parent021f06745901acb7d09ac3aff4aea52495cae730 (diff)
downloadqemu-131ec1bd7de661f20f178f582430a9d0d0cfa9b4.tar.gz
qemu-131ec1bd7de661f20f178f582430a9d0d0cfa9b4.tar.bz2
qemu-131ec1bd7de661f20f178f582430a9d0d0cfa9b4.zip
qdev: device free fixups.
Two bug fixes: * When freeing a device we unregister even stuff we didn't register in the first place because the ->init() callback failed. * When freeing a device with child busses attached, we fail to zap the child bus (and the devices attached to it). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.h')
-rw-r--r--hw/qdev.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/qdev.h b/hw/qdev.h
index 51d835f616..cd58fa8cf4 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -19,10 +19,16 @@ typedef struct BusState BusState;
typedef struct BusInfo BusInfo;
+enum DevState {
+ DEV_STATE_CREATED = 1,
+ DEV_STATE_INITIALIZED,
+};
+
/* This structure should not be accessed directly. We declare it here
so that it can be embedded in individual device state structures. */
struct DeviceState {
const char *id;
+ enum DevState state;
DeviceInfo *info;
BusState *parent_bus;
int num_gpio_out;
@@ -149,6 +155,7 @@ BusState *qdev_get_parent_bus(DeviceState *dev);
void qbus_create_inplace(BusState *bus, BusInfo *info,
DeviceState *parent, const char *name);
BusState *qbus_create(BusInfo *info, DeviceState *parent, const char *name);
+void qbus_free(BusState *bus);
#define FROM_QBUS(type, dev) DO_UPCAST(type, qbus, dev)