From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rxo5H-0000wP-Ay for qemu-devel@nongnu.org; Wed, 15 Feb 2012 18:16:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rxo5G-0000LI-4n for qemu-devel@nongnu.org; Wed, 15 Feb 2012 18:16:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rxo5F-0000L8-TE for qemu-devel@nongnu.org; Wed, 15 Feb 2012 18:16:22 -0500 From: Igor Mammedov Date: Thu, 16 Feb 2012 00:16:10 +0100 Message-Id: <1329347774-23262-4-git-send-email-imammedo@redhat.com> In-Reply-To: <1329347774-23262-1-git-send-email-imammedo@redhat.com> References: <1329347774-23262-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH 3/7] cleanup: get rid of pc_new_cpu List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: jan.kiszka@siemens.com, gleb@redhat.com 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 --- 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