@@ -328,7 +328,6 @@ void qdev_init_nofail(DeviceState *dev);
bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp);
bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp);
void qdev_unrealize(DeviceState *dev);
-
void qdev_set_legacy_instance_id(DeviceState *dev, int alias_id,
int required_for_version);
HotplugHandler *qdev_get_bus_hotplug_handler(DeviceState *dev);
@@ -421,7 +421,7 @@ static void device_reset_child_foreach(Object *obj, ResettableChildCallback cb,
void qdev_simple_device_unplug_cb(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
- object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
+ qdev_unrealize(dev);
}
/*
@@ -493,6 +493,11 @@ bool qdev_realize(DeviceState *dev, BusState *bus, Error **errp)
return !err;
}
+void qdev_unrealize(DeviceState *dev)
+{
+ object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
+}
+
/*
* Realize @dev and drop a reference.
* This is like qdev_realize(), except it steals a reference rather
@@ -512,11 +517,6 @@ bool qdev_realize_and_unref(DeviceState *dev, BusState *bus, Error **errp)
return ret;
}
-void qdev_unrealize(DeviceState *dev)
-{
- object_property_set_bool(OBJECT(dev), false, "realized", &error_abort);
-}
-
static int qdev_assert_realized_properly(Object *obj, void *opaque)
{
DeviceState *dev = DEVICE(object_dynamic_cast(obj, TYPE_DEVICE));
@@ -1187,7 +1187,7 @@ static void device_unparent(Object *obj)
BusState *bus;
if (dev->realized) {
- object_property_set_bool(obj, false, "realized", &error_abort);
+ qdev_unrealize(dev);
}
while (dev->num_child_bus) {
bus = QLIST_FIRST(&dev->child_bus);
Signed-off-by: Markus Armbruster <armbru@redhat.com> --- include/hw/qdev-core.h | 1 - hw/core/qdev.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-)