Patchwork [RFC,qom-cpu,01/15] target-alpha: Update CPU to QOM realizefn

login
register
mail settings
Submitter Andreas Färber
Date Jan. 16, 2013, 5:32 a.m.
Message ID <1358314380-9400-2-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/212391/
State New
Headers show

Comments

Andreas Färber - Jan. 16, 2013, 5:32 a.m.
Update the alpha_cpu_realize() signature and hook up to
DeviceClass::realize. Set realized = true in cpu_alpha_init().

qapi/error.h is included through qdev now and no longer needed.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-alpha/cpu.c |   15 +++++++++++----
 1 Datei geändert, 11 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)

Patch

diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 40e9809..3ce509c 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -21,12 +21,11 @@ 
 
 #include "cpu.h"
 #include "qemu-common.h"
-#include "qapi/error.h"
 
 
-static void alpha_cpu_realize(Object *obj, Error **errp)
+static void alpha_cpu_realizefn(DeviceState *dev, Error **errp)
 {
-    AlphaCPU *cpu = ALPHA_CPU(obj);
+    AlphaCPU *cpu = ALPHA_CPU(dev);
 
     qemu_init_vcpu(&cpu->env);
 }
@@ -130,7 +129,7 @@  AlphaCPU *cpu_alpha_init(const char *cpu_model)
 
     env->cpu_model_str = cpu_model;
 
-    alpha_cpu_realize(OBJECT(cpu), NULL);
+    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
     return cpu;
 }
 
@@ -244,6 +243,13 @@  static void alpha_cpu_initfn(Object *obj)
     env->fen = 1;
 }
 
+static void alpha_cpu_class_init(ObjectClass *oc, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(oc);
+
+    dc->realize = alpha_cpu_realizefn;
+}
+
 static const TypeInfo alpha_cpu_type_info = {
     .name = TYPE_ALPHA_CPU,
     .parent = TYPE_CPU,
@@ -251,6 +257,7 @@  static const TypeInfo alpha_cpu_type_info = {
     .instance_init = alpha_cpu_initfn,
     .abstract = true,
     .class_size = sizeof(AlphaCPUClass),
+    .class_init = alpha_cpu_class_init,
 };
 
 static void alpha_cpu_register_types(void)