]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
qdev: Drop misleading qbus_free() function
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 18 Dec 2013 16:15:51 +0000 (17:15 +0100)
committerAndreas Färber <afaerber@suse.de>
Tue, 24 Dec 2013 17:02:18 +0000 (18:02 +0100)
Same reasoning as commit 02a5c4c97422b40034f31265e0f139f7846172a8
("qdev: Drop misleading qdev_free() function").  The qbus_free()
function removes the child from the namespace and decrements the
reference count.  It does not, however, guarantee to free the child
since the refcount may still be held.

Just call object_unparent() directly.

Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
hw/core/qdev.c
hw/pci/pci_bridge.c
include/hw/qdev-core.h

index e374a9399fc687f328b6ae9a40991cc58d6c77e3..bbd780aad100cc8674cb1eadf983492893b70238 100644 (file)
@@ -481,11 +481,6 @@ BusState *qbus_create(const char *typename, DeviceState *parent, const char *nam
     return bus;
 }
 
-void qbus_free(BusState *bus)
-{
-    object_unparent(OBJECT(bus));
-}
-
 static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
 {
     BusClass *bc = BUS_GET_CLASS(bus);
@@ -794,7 +789,7 @@ static void device_unparent(Object *obj)
 
     while (dev->num_child_bus) {
         bus = QLIST_FIRST(&dev->child_bus);
-        qbus_free(bus);
+        object_unparent(OBJECT(bus));
     }
     if (dev->realized) {
         object_property_set_bool(obj, false, "realized", NULL);
index f72872ebcf1cd4c9a6284771e9a4fe757431f92b..355c3e1b068fd439fff0dc91b4f5dd127694716b 100644 (file)
@@ -391,7 +391,7 @@ void pci_bridge_exitfn(PCIDevice *pci_dev)
     pci_bridge_region_cleanup(s, s->windows);
     memory_region_destroy(&s->address_space_mem);
     memory_region_destroy(&s->address_space_io);
-    /* qbus_free() is called automatically during device deletion */
+    /* object_unparent() is called automatically during device deletion */
 }
 
 /*
index c8945a412af461d80bbef71a76a8cf269a8283c8..651c3e54eea492dea70decdd916c2cb3103227e7 100644 (file)
@@ -283,8 +283,6 @@ void qdev_reset_all(DeviceState *dev);
 void qbus_reset_all(BusState *bus);
 void qbus_reset_all_fn(void *opaque);
 
-void qbus_free(BusState *bus);
-
 /* This should go away once we get rid of the NULL bus hack */
 BusState *sysbus_get_default(void);