Patchwork [v4,10/13] qdev: inline object_delete into qbus_free/qdev_free

login
register
mail settings
Submitter Paolo Bonzini
Date Jan. 25, 2013, 1:12 p.m.
Message ID <1359119559-19075-11-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/215678/
State New
Headers show

Comments

Paolo Bonzini - Jan. 25, 2013, 1:12 p.m.
We want object_delete to disappear, and we will do this one class at a
time.  Inline it for the qdev case, which we will tackle first.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/qdev.c b/hw/qdev.c
index 1dabcad..09f5969 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -267,7 +267,8 @@  void qdev_init_nofail(DeviceState *dev)
 /* Unlink device from bus and free the structure.  */
 void qdev_free(DeviceState *dev)
 {
-    object_delete(OBJECT(dev));
+    object_unparent(OBJECT(dev));
+    object_unref(OBJECT(dev));
 }
 
 void qdev_machine_creation_done(void)
@@ -472,7 +473,8 @@  BusState *qbus_create(const char *typename, DeviceState *parent, const char *nam
 
 void qbus_free(BusState *bus)
 {
-    object_delete(OBJECT(bus));
+    object_unparent(OBJECT(bus));
+    object_unref(OBJECT(bus));
 }
 
 static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)