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: Marc-André Lureau <[email protected]> --- include/hw/core/qdev-properties.h | 4 --- hw/core/qdev-properties.c | 59 +++++++++++---------------------------- 2 files changed, 17 insertions(+), 46 deletions(-) diff --git a/include/hw/core/qdev-properties.h b/include/hw/core/qdev-properties.h index 8dd80501fb8..937b11dad09 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; diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index c9c29578d99..bcf72222d8d 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, @@ -667,18 +664,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; } /* @@ -1099,7 +1090,6 @@ static ObjectProperty *create_link_property(ObjectClass *oc, const char *name, } const PropertyInfo qdev_prop_link = { - .type = "link", .create = create_link_property, }; @@ -1123,20 +1113,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); @@ -1160,21 +1143,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); -- 2.54.0
