|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 61/65] qdev: remove deprecated PropertyInfo.type and .enum_table fields
Now that all PropertyInfo definitions use .qapi_type, remove the
legacy .type (string) and .enum_table fields from PropertyInfo, and
the .arrayinfo/.arrayfieldsize fields from Property.
Remove fallback branches in qdev_property_add_static() and
qdev_class_add_property() that used object_property_add() with
prop->info->type: these always use the QAPI-aware registration
path now. Simplify qdev_propinfo_enum_lookup(), prop_array_info()
and prop_array_elem_size() to use the new fields directly.
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
hw/core/qdev-properties.c | 58 ++++++++++++---------------------------
include/hw/core/qdev-properties.h | 4 ---
2 files changed, 17 insertions(+), 45 deletions(-)
diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
index 5c403cc2e57e..a121878467e1 100644
--- a/hw/core/qdev-properties.c
+++ b/hw/core/qdev-properties.c
@@ -103,11 +103,8 @@ static ObjectPropertyAccessor *field_prop_setter(const
PropertyInfo *info)
const QEnumLookup *qdev_propinfo_enum_lookup(const PropertyInfo *info)
{
- if (info->qapi_type) {
- assert(info->qapi_type->lookup);
- return info->qapi_type->lookup;
- }
- return info->enum_table;
+ assert(info->qapi_type->lookup);
+ return info->qapi_type->lookup;
}
void qdev_propinfo_get_enum(Object *obj, Visitor *v, const char *name,
@@ -668,18 +665,12 @@ struct ArrayElementList {
static const PropertyInfo *prop_array_info(const Property *prop)
{
- if (prop->info->element_info) {
- return prop->info->element_info;
- }
- return prop->arrayinfo;
+ return prop->info->element_info;
}
static int prop_array_elem_size(const Property *prop)
{
- if (prop->info->element_size) {
- return prop->info->element_size;
- }
- return prop->arrayfieldsize;
+ return prop->info->element_size;
}
/*
@@ -1224,20 +1215,13 @@ void qdev_property_add_static(DeviceState *dev, const
Property *prop)
const QAPITypeInfo *qapi_type = qdev_prop_qapi_type(prop);
assert(!prop->info->create);
+ assert(qapi_type);
- if (qapi_type) {
- op = object_property_add_qapi(obj, prop->name, qapi_type,
- field_prop_getter(prop->info),
- field_prop_setter(prop->info),
- prop->info->release,
- (Property *)prop);
- } else {
- op = object_property_add(obj, prop->name, prop->info->type,
- field_prop_getter(prop->info),
- field_prop_setter(prop->info),
- prop->info->release,
- (Property *)prop);
- }
+ op = object_property_add_qapi(obj, prop->name, qapi_type,
+ field_prop_getter(prop->info),
+ field_prop_setter(prop->info),
+ prop->info->release,
+ (Property *)prop);
object_property_set_description(obj, prop->name,
prop->info->description);
@@ -1261,21 +1245,13 @@ static void qdev_class_add_property(DeviceClass *klass,
const char *name,
} else {
const QAPITypeInfo *qapi_type = qdev_prop_qapi_type(prop);
- if (qapi_type) {
- op = object_class_property_add_qapi(oc,
- name, qapi_type,
- field_prop_getter(prop->info),
- field_prop_setter(prop->info),
- prop->info->release,
- (Property *)prop);
- } else {
- op = object_class_property_add(oc,
- name, prop->info->type,
- field_prop_getter(prop->info),
- field_prop_setter(prop->info),
- prop->info->release,
- (Property *)prop);
- }
+ assert(qapi_type);
+ op = object_class_property_add_qapi(oc,
+ name, qapi_type,
+ field_prop_getter(prop->info),
+ field_prop_setter(prop->info),
+ prop->info->release,
+ (Property *)prop);
}
if (prop->set_default) {
prop->info->set_default_value(op, prop);
diff --git a/include/hw/core/qdev-properties.h
b/include/hw/core/qdev-properties.h
index 39f95ce7a3c6..2267e734d1fd 100644
--- a/include/hw/core/qdev-properties.h
+++ b/include/hw/core/qdev-properties.h
@@ -23,17 +23,13 @@ struct Property {
int64_t i;
uint64_t u;
} defval;
- const PropertyInfo *arrayinfo;
int arrayoffset;
- int arrayfieldsize;
uint8_t bitnr;
bool set_default;
};
struct PropertyInfo {
- const char *type;
const char *description;
- const QEnumLookup *enum_table;
const QAPITypeInfo *qapi_type;
const struct PropertyInfo *element_info;
int element_size;
--
2.56.0.116.g6de20f6092dc
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |