* [Qemu-devel] [PATCH] qdev: Drop misleading qbus_free() function
@ 2013-12-18 16:15 Stefan Hajnoczi
2013-12-18 16:33 ` Andreas Färber
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-12-18 16:15 UTC (permalink / raw)
To: qemu-devel; +Cc: Andreas Faerber, Markus Armbruster
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>
---
hw/core/qdev.c | 7 +------
hw/pci/pci_bridge.c | 2 +-
include/hw/qdev-core.h | 2 --
3 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index e374a93..bbd780a 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -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);
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index f72872e..355c3e1 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -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 */
}
/*
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index f2043a6..2f6e1d1 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -272,8 +272,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);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Qemu-devel] [PATCH] qdev: Drop misleading qbus_free() function
2013-12-18 16:15 [Qemu-devel] [PATCH] qdev: Drop misleading qbus_free() function Stefan Hajnoczi
@ 2013-12-18 16:33 ` Andreas Färber
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Färber @ 2013-12-18 16:33 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: Markus Armbruster
Am 18.12.2013 17:15, schrieb Stefan Hajnoczi:
> 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>
Thanks, nice and trivial, applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-18 16:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-18 16:15 [Qemu-devel] [PATCH] qdev: Drop misleading qbus_free() function Stefan Hajnoczi
2013-12-18 16:33 ` Andreas Färber
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.