On Fri, 11 Dec 2020 17:05:21 -0500 Eduardo Habkost <ehabk...@redhat.com> wrote:
> Returning ObjectProperty* will be useful for new property > registration code that will add additional callbacks > to ObjectProperty after registering it. > > Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> Reviewed-by: Igor Mammedov <imamm...@redhat.com> > --- > Changes v1 -> v2: > * Redone patch on top of additional changes in series v2 > * Commit message reword > --- > Cc: Paolo Bonzini <pbonz...@redhat.com> > Cc: "Daniel P. Berrangé" <berra...@redhat.com> > Cc: Eduardo Habkost <ehabk...@redhat.com> > Cc: qemu-devel@nongnu.org > --- > include/hw/qdev-properties.h | 3 ++- > hw/core/qdev-properties.c | 12 ++++++------ > 2 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h > index ab9c538ba4..aae882317a 100644 > --- a/include/hw/qdev-properties.h > +++ b/include/hw/qdev-properties.h > @@ -34,7 +34,8 @@ struct PropertyInfo { > const QEnumLookup *enum_table; > int (*print)(Object *obj, Property *prop, char *dest, size_t len); > void (*set_default_value)(ObjectProperty *op, const Property *prop); > - void (*create)(ObjectClass *oc, const char *name, Property *prop); > + ObjectProperty *(*create)(ObjectClass *oc, const char *name, > + Property *prop); > ObjectPropertyAccessor *get; > ObjectPropertyAccessor *set; > ObjectPropertyRelease *release; > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c > index 92f48ecbf2..3bb05e7d0d 100644 > --- a/hw/core/qdev-properties.c > +++ b/hw/core/qdev-properties.c > @@ -821,13 +821,13 @@ const PropertyInfo qdev_prop_size = { > > /* --- object link property --- */ > > -static void create_link_property(ObjectClass *oc, const char *name, > - Property *prop) > +static ObjectProperty *create_link_property(ObjectClass *oc, const char > *name, > + Property *prop) > { > - object_class_property_add_link(oc, name, prop->link_type, > - prop->offset, > - qdev_prop_allow_set_link_before_realize, > - OBJ_PROP_LINK_STRONG); > + return object_class_property_add_link(oc, name, prop->link_type, > + prop->offset, > + > qdev_prop_allow_set_link_before_realize, > + OBJ_PROP_LINK_STRONG); > } > > const PropertyInfo qdev_prop_link = {