aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core')
-rw-r--r--hw/core/machine.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index dc15f5f9e5..7c4004ac5a 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -548,18 +548,25 @@ void machine_class_allow_dynamic_sysbus_dev(MachineClass *mc, const char *type)
bool device_is_dynamic_sysbus(MachineClass *mc, DeviceState *dev)
{
- bool allowed = false;
- strList *wl;
Object *obj = OBJECT(dev);
if (!object_dynamic_cast(obj, TYPE_SYS_BUS_DEVICE)) {
return false;
}
+ return device_type_is_dynamic_sysbus(mc, object_get_typename(obj));
+}
+
+bool device_type_is_dynamic_sysbus(MachineClass *mc, const char *type)
+{
+ bool allowed = false;
+ strList *wl;
+ ObjectClass *klass = object_class_by_name(type);
+
for (wl = mc->allowed_dynamic_sysbus_devices;
!allowed && wl;
wl = wl->next) {
- allowed |= !!object_dynamic_cast(obj, wl->value);
+ allowed |= !!object_class_dynamic_cast(klass, wl->value);
}
return allowed;