From 77b06bba62034a87cc61a9c8de1309ae3e527d97 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Fri, 10 Jan 2020 19:30:34 +0400 Subject: qdev: register properties as class properties Use class properties facilities to add properties to the class during device_class_set_props(). qdev_property_add_static() must be adapted as PropertyInfo now operates with classes (and not instances), so we must set_default_value() on the ObjectProperty, before calling its init() method on the object instance. Also, PropertyInfo.create() is now exclusively used for class properties. Fortunately, qdev_property_add_static() is only used in target/arm/cpu.c so far, which doesn't use "link" properties (that require create()). Signed-off-by: Marc-André Lureau Message-Id: <20200110153039.1379601-22-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/hw/qdev-core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 506ad359c9..5da94f872a 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -263,8 +263,8 @@ struct PropertyInfo { const char *description; const QEnumLookup *enum_table; int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); - void (*set_default_value)(Object *obj, const Property *prop); - void (*create)(Object *obj, Property *prop, Error **errp); + void (*set_default_value)(ObjectProperty *op, const Property *prop); + void (*create)(ObjectClass *oc, Property *prop, Error **errp); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; -- cgit v1.2.3-55-g7522