All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: afaerber@suse.de, peter.maydell@linaro.org
Cc: armbru@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com,
	qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [RFC 2/4] s390: Don't use class properties
Date: Thu, 29 Sep 2016 10:16:43 +1000	[thread overview]
Message-ID: <1475108205-6043-3-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1475108205-6043-1-git-send-email-david@gibson.dropbear.id.au>

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

  parent reply	other threads:[~2016-09-29  0:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  0:16 [Qemu-devel] [RFC 0/4] QOM class properties - do we need them? David Gibson
2016-09-29  0:16 ` [Qemu-devel] [RFC 1/4] qcrypto: Remove usage of class properties David Gibson
2016-09-29  0:16 ` David Gibson [this message]
2016-09-29  0:16 ` [Qemu-devel] [RFC 3/4] tests: Remove tests for " David Gibson
2016-09-29  0:16 ` [Qemu-devel] [RFC 4/4] qom: Abolish " David Gibson
2016-09-29  7:52 ` [Qemu-devel] [RFC 0/4] QOM class properties - do we need them? Paolo Bonzini
2016-09-29  8:14 ` Daniel P. Berrange
2016-09-29 10:12   ` Andreas Färber
2016-09-29 10:21     ` Daniel P. Berrange
2016-09-29 10:23       ` Andreas Färber
2016-09-29 23:36         ` David Gibson
2016-10-04  9:51         ` Kevin Wolf
2016-09-29 23:33   ` David Gibson
2016-09-30  8:06     ` Daniel P. Berrange
2016-09-29 10:16 ` Andreas Färber
2016-09-29 23:37   ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475108205-6043-3-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.