diff mbox

[RFC,2/4] s390: Don't use class properties

Message ID 1475108205-6043-3-git-send-email-david@gibson.dropbear.id.au
State New
Headers show

Commit Message

David Gibson Sept. 29, 2016, 12:16 a.m. UTC
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 <david@gibson.dropbear.id.au>
---
 target-s390x/cpu.c        |  1 -
 target-s390x/cpu_models.c | 47 ++++++++++++++++++++++-------------------------
 2 files changed, 22 insertions(+), 26 deletions(-)
diff mbox

Patch

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)
 {