qdev: inline object_delete into qbus_free/qdev_free
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 25 Jan 2013 13:12:36 +0000 (14:12 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 1 Feb 2013 21:53:10 +0000 (15:53 -0600)
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/qdev.c

index 1dabcad2a624b40eeb0e99c33d34f930b83928b2..09f59698c9c83ae0711410beb27a191d32d1d689 100644 (file)
--- 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)