Patchwork [RFC,13/20] target-openrisc: replace cpu_openrisc_init() with generic_cpu_init()

login
register
mail settings
Submitter Eduardo Habkost
Date Dec. 18, 2012, 8:04 p.m.
Message ID <1355861053-11460-14-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/207213/
State New
Headers show

Comments

Eduardo Habkost - Dec. 18, 2012, 8:04 p.m.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/openrisc_sim.c     |  2 +-
 target-openrisc/cpu.c | 22 ----------------------
 target-openrisc/cpu.h |  4 +---
 3 files changed, 2 insertions(+), 26 deletions(-)

Patch

diff --git a/hw/openrisc_sim.c b/hw/openrisc_sim.c
index 440dc9e..1955854 100644
--- a/hw/openrisc_sim.c
+++ b/hw/openrisc_sim.c
@@ -105,7 +105,7 @@  static void openrisc_sim_init(QEMUMachineInitArgs *args)
     }
 
     for (n = 0; n < smp_cpus; n++) {
-        cpu = cpu_openrisc_init(cpu_model);
+        cpu = OPENRISC_CPU(generic_cpu_init(TYPE_OPENRISC_CPU, cpu_model));
         if (cpu == NULL) {
             qemu_log("Unable to find CPU defineition!\n");
             exit(1);
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index 0a8253e..1ec4e2a 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -157,28 +157,6 @@  static void openrisc_cpu_register_types(void)
     }
 }
 
-OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
-{
-    OpenRISCCPU *cpu;
-    Error *err = NULL;
-
-    if (!object_class_by_name(cpu_model)) {
-        return NULL;
-    }
-    cpu = OPENRISC_CPU(object_new(cpu_model));
-    CPU(cpu)->cpu_model_str = cpu_model;
-
-    cpu_realize(CPU(cpu), &err);
-    if (err) {
-        goto error;
-    }
-
-    return cpu;
-error:
-    error_report("cpu_openrisc_init: %s", error_get_pretty(err));
-    return NULL;
-}
-
 typedef struct OpenRISCCPUList {
     fprintf_function cpu_fprintf;
     FILE *file;
diff --git a/target-openrisc/cpu.h b/target-openrisc/cpu.h
index d0a2fdc..e6b3bfa 100644
--- a/target-openrisc/cpu.h
+++ b/target-openrisc/cpu.h
@@ -346,8 +346,6 @@  static inline CPUOpenRISCState *openrisc_cpu_get_env(OpenRISCCPU *cpu)
 
 #define CPU_GET_ENV(cpu) openrisc_cpu_get_env(OPENRISC_CPU(cpu))
 
-OpenRISCCPU *cpu_openrisc_init(const char *cpu_model);
-
 void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf);
 int cpu_openrisc_exec(CPUOpenRISCState *s);
 void do_interrupt(CPUOpenRISCState *env);
@@ -385,7 +383,7 @@  int cpu_openrisc_get_phys_data(OpenRISCCPU *cpu,
                                int *prot, target_ulong address, int rw);
 #endif
 
-#define cpu_init(m) CPU(cpu_openrisc_init(m))
+#define cpu_init(m) generic_cpu_init(TYPE_OPENRISC_CPU, m)
 
 #if defined(CONFIG_USER_ONLY)
 static inline void cpu_clone_regs(CPUOpenRISCState *env, target_ulong newsp)