summaryrefslogtreecommitdiffstats
path: root/hw/core/qdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r--hw/core/qdev.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 6b3cc55b27..d59071b8ed 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type)
return dev;
}
-static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners
+static QTAILQ_HEAD(, DeviceListener) device_listeners
= QTAILQ_HEAD_INITIALIZER(device_listeners);
enum ListenerDirection { Forward, Reverse };
@@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse };
break; \
case Reverse: \
QTAILQ_FOREACH_REVERSE(_listener, &device_listeners, \
- device_listeners, link) { \
+ link) { \
if (_listener->_callback) { \
_listener->_callback(_listener, ##_args); \
} \
@@ -970,8 +970,26 @@ static void device_initfn(Object *obj)
QLIST_INIT(&dev->gpios);
}
+void object_apply_compat_props(Object *obj)
+{
+ if (object_dynamic_cast(qdev_get_machine(), TYPE_MACHINE)) {
+ MachineState *m = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(m);
+
+ if (m->accelerator) {
+ AccelClass *ac = ACCEL_GET_CLASS(m->accelerator);
+
+ if (ac->compat_props) {
+ object_apply_global_props(obj, ac->compat_props, &error_abort);
+ }
+ }
+ object_apply_global_props(obj, mc->compat_props, &error_abort);
+ }
+}
+
static void device_post_init(Object *obj)
{
+ object_apply_compat_props(obj);
qdev_prop_set_globals(DEVICE(obj));
}