diff mbox

[RFC,6/7] x86-cpu: register properties against the class instead of object

Message ID 1440590594-5514-7-git-send-email-berrange@redhat.com
State New
Headers show

Commit Message

Daniel P. Berrangé Aug. 26, 2015, 12:03 p.m. UTC
This converts the x86 CPU object to register its properties against
the class rather than object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 target-i386/cpu.c | 55 ++++++++++++++++++++++++++++---------------------------
 1 file changed, 28 insertions(+), 27 deletions(-)
diff mbox

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 780a5bc..e183d0b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3038,33 +3038,6 @@  static void x86_cpu_initfn(Object *obj)
     cs->env_ptr = env;
     cpu_exec_init(cs, &error_abort);
 
-    object_property_add(obj, "family", "int",
-                        x86_cpuid_version_get_family,
-                        x86_cpuid_version_set_family, NULL, NULL, NULL);
-    object_property_add(obj, "model", "int",
-                        x86_cpuid_version_get_model,
-                        x86_cpuid_version_set_model, NULL, NULL, NULL);
-    object_property_add(obj, "stepping", "int",
-                        x86_cpuid_version_get_stepping,
-                        x86_cpuid_version_set_stepping, NULL, NULL, NULL);
-    object_property_add_str(obj, "vendor",
-                            x86_cpuid_get_vendor,
-                            x86_cpuid_set_vendor, NULL);
-    object_property_add_str(obj, "model-id",
-                            x86_cpuid_get_model_id,
-                            x86_cpuid_set_model_id, NULL);
-    object_property_add(obj, "tsc-frequency", "int",
-                        x86_cpuid_get_tsc_freq,
-                        x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
-    object_property_add(obj, "apic-id", "int",
-                        x86_cpuid_get_apic_id,
-                        x86_cpuid_set_apic_id, NULL, NULL, NULL);
-    object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
-                        x86_cpu_get_feature_words,
-                        NULL, NULL, NULL, NULL);
-    object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
-                        x86_cpu_get_filtered_features,
-                        NULL, NULL, NULL, NULL);
 
     cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
 
@@ -3199,6 +3172,34 @@  static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
 #endif
     cc->cpu_exec_enter = x86_cpu_exec_enter;
     cc->cpu_exec_exit = x86_cpu_exec_exit;
+
+    object_class_property_add(oc, "family", "int",
+                              x86_cpuid_version_get_family,
+                              x86_cpuid_version_set_family, NULL, NULL, NULL);
+    object_class_property_add(oc, "model", "int",
+                              x86_cpuid_version_get_model,
+                              x86_cpuid_version_set_model, NULL, NULL, NULL);
+    object_class_property_add(oc, "stepping", "int",
+                              x86_cpuid_version_get_stepping,
+                              x86_cpuid_version_set_stepping, NULL, NULL, NULL);
+    object_class_property_add_str(oc, "vendor",
+                                  x86_cpuid_get_vendor,
+                                  x86_cpuid_set_vendor, NULL);
+    object_class_property_add_str(oc, "model-id",
+                                  x86_cpuid_get_model_id,
+                                  x86_cpuid_set_model_id, NULL);
+    object_class_property_add(oc, "tsc-frequency", "int",
+                              x86_cpuid_get_tsc_freq,
+                              x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
+    object_class_property_add(oc, "apic-id", "int",
+                              x86_cpuid_get_apic_id,
+                              x86_cpuid_set_apic_id, NULL, NULL, NULL);
+    object_class_property_add(oc, "feature-words", "X86CPUFeatureWordInfo",
+                              x86_cpu_get_feature_words,
+                              NULL, NULL, NULL, NULL);
+    object_class_property_add(oc, "filtered-features", "X86CPUFeatureWordInfo",
+                              x86_cpu_get_filtered_features,
+                              NULL, NULL, NULL, NULL);
 }
 
 static const TypeInfo x86_cpu_type_info = {