qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/7] cleanup: get rid of pc_new_cpu


From: Igor Mammedov
Subject: [Qemu-devel] [PATCH 3/7] cleanup: get rid of pc_new_cpu
Date: Thu, 16 Feb 2012 00:16:10 +0100

Since pc_new_cpu is used only once and to simplify implementation
of pc_cpus_init, pc_new_cpu body just moved into pc_cpus_init.

Signed-off-by: Igor Mammedov <address@hidden>
---
 hw/pc.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index b8db5dc..d9c397a 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -936,23 +936,6 @@ static void pc_cpu_reset(void *opaque)
     env->halted = !cpu_is_bsp(env);
 }
 
-static DeviceState *pc_new_cpu(const char *cpu_model)
-{
-    DeviceState *dev;
-    BusState *b;
-
-    b = get_icc_bus();
-    dev = qdev_create(b, "cpu-pc");
-    if (!dev) {
-        return NULL;
-    }
-    qdev_prop_set_string(dev, "model", g_strdup(cpu_model));
-    if (qdev_init(dev) < 0) {
-        return NULL;
-    }
-    return dev;
-}
-
 static int cpu_device_init(ICCBusDevice *dev)
 {
     CPUPC* cpu = DO_UPCAST(CPUPC, busdev, dev);
@@ -995,6 +978,8 @@ device_init(pc_register_devices);
 
 void pc_cpus_init(const char *cpu_model)
 {
+    DeviceState *dev;
+    BusState *b;
     int i;
 
     /* init CPUs */
@@ -1011,8 +996,17 @@ void pc_cpus_init(const char *cpu_model)
         qdev_init_nofail(d);
     }
 
+    b = get_icc_bus();
     for(i = 0; i < smp_cpus; i++) {
-        pc_new_cpu(cpu_model);
+        dev = qdev_create(b, "cpu-pc");
+        if (!dev) {
+            return;
+        }
+
+        qdev_prop_set_string(dev, "model", g_strdup(cpu_model));
+        if (qdev_init(dev) < 0) {
+            return;
+        }
     }
 }
 
-- 
1.7.7.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]