Make qdev inherit from TYPE_OBJECT_COMPAT, so it's own instance_post_init() only needs to apply the global properties instead. Order kept because we run post hooks in parents then children.
Signed-off-by: Peter Xu <[email protected]> --- hw/core/qdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index fab42a7270..49504ff05a 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -683,9 +683,9 @@ static void device_post_init(Object *obj) { /* * Note: ordered so that the user's global properties take - * precedence. + * precedence over compat properties. Compat-properties will be + * applied first in the parent class (TYPE_OBJECT_COMPAT). */ - object_apply_compat_props(obj); qdev_prop_set_globals(DEVICE(obj)); } @@ -890,7 +890,7 @@ void phase_advance(MachineInitPhase phase) static const TypeInfo device_type_info = { .name = TYPE_DEVICE, - .parent = TYPE_OBJECT, + .parent = TYPE_OBJECT_COMPAT, .instance_size = sizeof(DeviceState), .instance_init = device_initfn, .instance_post_init = device_post_init, -- 2.50.1
