[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 50/59] qdev: move instance properties to class properties
From: |
Paolo Bonzini |
Subject: |
[PULL 50/59] qdev: move instance properties to class properties |
Date: |
Thu, 23 Jan 2020 14:50:40 +0100 |
From: Marc-André Lureau <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/core/qdev.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 100e266..6e4dca1 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)
--
1.8.3.1
- [PULL 39/59] object: add object_property_set_default, (continued)
- [PULL 39/59] object: add object_property_set_default, Paolo Bonzini, 2020/01/23
- [PULL 40/59] object: do not free class properties, Paolo Bonzini, 2020/01/23
- [PULL 41/59] object: check strong flag with &, Paolo Bonzini, 2020/01/23
- [PULL 42/59] object: rename link "child" to "target", Paolo Bonzini, 2020/01/23
- [PULL 43/59] object: add direct link flag, Paolo Bonzini, 2020/01/23
- [PULL 44/59] object: express const link with link property, Paolo Bonzini, 2020/01/23
- [PULL 45/59] object: add object_class_property_add_link(), Paolo Bonzini, 2020/01/23
- [PULL 46/59] object: release all props, Paolo Bonzini, 2020/01/23
- [PULL 47/59] object: return self in object_ref(), Paolo Bonzini, 2020/01/23
- [PULL 49/59] qdev: rename DeviceClass.props, Paolo Bonzini, 2020/01/23
- [PULL 50/59] qdev: move instance properties to class properties,
Paolo Bonzini <=
- [PULL 52/59] vl: print default value in object help, Paolo Bonzini, 2020/01/23
- [PULL 51/59] qdev: register properties as class properties, Paolo Bonzini, 2020/01/23
- [PULL 53/59] qom: simplify qmp_device_list_properties(), Paolo Bonzini, 2020/01/23
- [PULL 54/59] qom: introduce object_property_help(), Paolo Bonzini, 2020/01/23
- [PULL 55/59] qapi/qmp: add ObjectPropertyInfo.default-value, Paolo Bonzini, 2020/01/23
- [PULL 56/59] qdev: use object_property_help(), Paolo Bonzini, 2020/01/23
- [PULL 57/59] target/i386: Add the 'model-id' for Skylake -v3 CPU models, Paolo Bonzini, 2020/01/23
- [PULL 59/59] tests: fix test-qga on macosx, Paolo Bonzini, 2020/01/23
- [PULL 58/59] build-sys: clean up flags included in the linker command line, Paolo Bonzini, 2020/01/23
- [PULL 48/59] qdev: set properties with device_class_set_props(), Paolo Bonzini, 2020/01/23