diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2020-01-10 19:30:33 +0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-01-24 20:59:16 +0100 |
commit | c68fc9359ba08594def82050e093a039376caddc (patch) | |
tree | 25fa421c35b752019bf4c7ee78f819ea74e38967 /hw/core/qdev.c | |
parent | 385d8f222a30687f17ffff7a1a697be18de1cbe8 (diff) |
qdev: move instance properties to class properties
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20200110153039.1379601-21-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/core/qdev.c')
-rw-r--r-- | hw/core/qdev.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 100e266ec5..6e4dca1f51 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -944,14 +944,6 @@ static void device_initfn(Object *obj) dev->realized = false; dev->allow_unplug_during_migration = false; - object_property_add_bool(obj, "realized", - device_get_realized, device_set_realized, NULL); - object_property_add_bool(obj, "hotpluggable", - device_get_hotpluggable, NULL, NULL); - object_property_add_bool(obj, "hotplugged", - device_get_hotplugged, NULL, - &error_abort); - class = object_get_class(OBJECT(dev)); do { for (prop = DEVICE_CLASS(class)->props_; prop && prop->name; prop++) { @@ -961,9 +953,6 @@ static void device_initfn(Object *obj) class = object_class_get_parent(class); } while (class != object_class_by_name(TYPE_DEVICE)); - object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, - (Object **)&dev->parent_bus, NULL, 0, - &error_abort); QLIST_INIT(&dev->gpios); } @@ -1059,6 +1048,19 @@ static void device_class_init(ObjectClass *class, void *data) dc->hotpluggable = true; dc->user_creatable = true; vc->get_id = device_vmstate_if_get_id; + + object_class_property_add_bool(class, "realized", + device_get_realized, device_set_realized, + &error_abort); + object_class_property_add_bool(class, "hotpluggable", + device_get_hotpluggable, NULL, + &error_abort); + object_class_property_add_bool(class, "hotplugged", + device_get_hotplugged, NULL, + &error_abort); + object_class_property_add_link(class, "parent_bus", TYPE_BUS, + offsetof(DeviceState, parent_bus), NULL, 0, + &error_abort); } void device_class_set_props(DeviceClass *dc, Property *props) |