From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIjKJ-00032z-D0 for qemu-devel@nongnu.org; Tue, 03 Feb 2015 14:40:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIjKI-0006zM-HR for qemu-devel@nongnu.org; Tue, 03 Feb 2015 14:39:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIjKI-0006zF-9D for qemu-devel@nongnu.org; Tue, 03 Feb 2015 14:39:58 -0500 From: Eduardo Habkost Date: Tue, 3 Feb 2015 17:39:25 -0200 Message-Id: <1422992371-4145-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1422992371-4145-1-git-send-email-ehabkost@redhat.com> References: <1422992371-4145-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/9] target-i386: Eliminate cpu_init() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gu Zheng , Igor Mammedov , Paolo Bonzini Instead of putting extra logic inside cpu.h, just do everything inside cpu_x86_init_user(). Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 6 +++--- target-i386/cpu.h | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 5e4010c..43d958e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2149,7 +2149,7 @@ out: return cpu; } -X86CPU *cpu_x86_init_user(const char *cpu_model) +CPUX86State *cpu_x86_init_user(const char *cpu_model) { Error *error = NULL; X86CPU *cpu; @@ -2167,10 +2167,10 @@ out: error_free(error); if (cpu != NULL) { object_unref(OBJECT(cpu)); - cpu = NULL; } + return NULL; } - return cpu; + return &cpu->env; } static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data) diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 41d7f0a..d5bd74e 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -982,7 +982,6 @@ typedef struct CPUX86State { #include "cpu-qom.h" -X86CPU *cpu_x86_init_user(const char *cpu_model); X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge, Error **errp); int cpu_x86_exec(CPUX86State *s); @@ -1171,14 +1170,9 @@ uint64_t cpu_get_tsc(CPUX86State *env); # define PHYS_ADDR_MASK 0xfffffffffLL # endif -static inline CPUX86State *cpu_init(const char *cpu_model) -{ - X86CPU *cpu = cpu_x86_init_user(cpu_model); - if (cpu == NULL) { - return NULL; - } - return &cpu->env; -} +/* CPU creation function for *-user */ +CPUX86State *cpu_x86_init_user(const char *cpu_model); +#define cpu_init cpu_x86_init_user #define cpu_exec cpu_x86_exec #define cpu_gen_code cpu_x86_gen_code -- 2.1.0