From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpP2U-0002nA-NR for qemu-devel@nongnu.org; Wed, 28 Sep 2016 20:17:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpP2R-0003CD-CO for qemu-devel@nongnu.org; Wed, 28 Sep 2016 20:17:26 -0400 Received: from ozlabs.org ([103.22.144.67]:57831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpP2R-0003Bm-2E for qemu-devel@nongnu.org; Wed, 28 Sep 2016 20:17:23 -0400 From: David Gibson Date: Thu, 29 Sep 2016 10:16:43 +1000 Message-Id: <1475108205-6043-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1475108205-6043-1-git-send-email-david@gibson.dropbear.id.au> References: <1475108205-6043-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [RFC 2/4] s390: Don't use class properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: afaerber@suse.de, peter.maydell@linaro.org Cc: armbru@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, David Gibson s390 is one of the very few users of QOM class properties (as opposed to instance properties). In anticipation of removing support for class properties, convert s390 to use instance properties instead. Signed-off-by: David Gibson --- target-s390x/cpu.c | 1 - target-s390x/cpu_models.c | 47 ++++++++++++++++++++++------------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c index 2f3c8e2..cadeef4 100644 --- a/target-s390x/cpu.c +++ b/target-s390x/cpu.c @@ -446,7 +446,6 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) * object_unref(). */ dc->cannot_destroy_with_object_finalize_yet = true; - s390_cpu_model_class_register_props(oc); } static const TypeInfo s390_cpu_type_info = { diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c index 3ff6a70..4e9afa3 100644 --- a/target-s390x/cpu_models.c +++ b/target-s390x/cpu_models.c @@ -865,11 +865,33 @@ static void set_feature_group(Object *obj, Visitor *v, const char *name, } } +static bool get_is_migration_safe(Object *obj, Error **errp) +{ + return S390_CPU_GET_CLASS(obj)->is_migration_safe; +} + +static bool get_is_static(Object *obj, Error **errp) +{ + return S390_CPU_GET_CLASS(obj)->is_static; +} + +static char *get_description(Object *obj, Error **errp) +{ + return g_strdup(S390_CPU_GET_CLASS(obj)->desc); +} + void s390_cpu_model_register_props(Object *obj) { S390FeatGroup group; S390Feat feat; + object_property_add_bool(obj, "migration-safe", get_is_migration_safe, + NULL, NULL); + object_property_add_bool(obj, "static", get_is_static, + NULL, NULL); + object_property_add_str(obj, "description", get_description, NULL, + NULL); + for (feat = 0; feat < S390_FEAT_MAX; feat++) { const S390FeatDef *def = s390_feat_def(feat); object_property_add(obj, def->name, "bool", get_feature, @@ -943,31 +965,6 @@ static void s390_cpu_model_finalize(Object *obj) cpu->model = NULL; } -static bool get_is_migration_safe(Object *obj, Error **errp) -{ - return S390_CPU_GET_CLASS(obj)->is_migration_safe; -} - -static bool get_is_static(Object *obj, Error **errp) -{ - return S390_CPU_GET_CLASS(obj)->is_static; -} - -static char *get_description(Object *obj, Error **errp) -{ - return g_strdup(S390_CPU_GET_CLASS(obj)->desc); -} - -void s390_cpu_model_class_register_props(ObjectClass *oc) -{ - object_class_property_add_bool(oc, "migration-safe", get_is_migration_safe, - NULL, NULL); - object_class_property_add_bool(oc, "static", get_is_static, - NULL, NULL); - object_class_property_add_str(oc, "description", get_description, NULL, - NULL); -} - #ifdef CONFIG_KVM static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data) { -- 2.7.4