Access BusState::allow_hotplug using wraper qbus_is_hotpluggable()
It would allow to transparently switch detection whether Bus
is hotpluggable from allow_hotplug field to hotplug_handler
link and to drop allow_hotplug field once all users are
converted to hotplug handler API.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 2b42d5b..df97003 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -86,7 +86,7 @@
BusChild *kid = g_malloc0(sizeof(*kid));
if (qdev_hotplug) {
- assert(bus->allow_hotplug);
+ assert(qbus_is_hotpluggable(bus));
}
kid->index = bus->max_index++;
@@ -213,7 +213,7 @@
{
DeviceClass *dc = DEVICE_GET_CLASS(dev);
- if (dev->parent_bus && !dev->parent_bus->allow_hotplug) {
+ if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
return;
}
@@ -948,7 +948,7 @@
DeviceState *dev = DEVICE(obj);
return dc->hotpluggable && (dev->parent_bus == NULL ||
- dev->parent_bus->allow_hotplug);
+ qbus_is_hotpluggable(dev->parent_bus));
}
static bool device_get_hotplugged(Object *obj, Error **err)