Marc-AndrĂ© Lureau <[email protected]> writes:

> Add a qapi_type field to PropertyInfo to prepare for the transition
> from string-based type metadata to QAPI type-info.
>
> Add a qdev_prop_qapi_type() helper that resolves the QAPI type for a
> property from .qapi_type. It will be later extended to cope with array
> types.
>
> Update qdev_property_add_static() and qdev_class_add_property() to
> prefer object_property_add_qapi() when a QAPI type is available, falling
> back to the old object_property_add() for unconverted properties.
>
> Update the shared enum accessor functions to prefer .qapi_type->lookup
> over .enum_table via a new qdev_propinfo_enum_lookup() helper.
>
> No PropertyInfo definitions are changed, all .qapi_type fields
> default to NULL, so the fallback paths are always taken. This patch
> is no-op for now.
>
> Signed-off-by: Marc-AndrĂ© Lureau <[email protected]>
> ---
>  hw/core/qdev-properties.c         | 67 
> +++++++++++++++++++++++++++++----------
>  include/hw/core/qdev-properties.h |  1 +
>  2 files changed, 52 insertions(+), 16 deletions(-)
>
> diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> index 34d7b26a7303..b3d5abd5053c 100644
> --- a/hw/core/qdev-properties.c
> +++ b/hw/core/qdev-properties.c

[...]

> @@ -114,14 +123,14 @@ void qdev_propinfo_set_enum(Object *obj, Visitor *v, 
> const char *name,
>      const Property *prop = opaque;
>      int *ptr = object_field_prop_ptr(obj, prop);
>  
> -    visit_type_enum(v, name, ptr, prop->info->enum_table, errp);
> +    visit_type_enum(v, name, ptr, qdev_propinfo_enum_lookup(prop->info), 
> errp);
>  }
>  
>  void qdev_propinfo_set_default_value_enum(ObjectProperty *op,
>                                            const Property *prop)
>  {
>      object_property_set_default_str(op,
> -        qapi_enum_lookup(prop->info->enum_table, prop->defval.i));
> +        qapi_enum_lookup(qdev_propinfo_enum_lookup(prop->info), 
> prop->defval.i));

scripts/checkpatch.pl warns

    WARNING: line over 80 characters

Easy enough to avoid.

>  }
>  
>  /* Bit */

[...]


Reply via email to