Received: from eggs.gnu.org ([2001:4830:134:3::10]:35764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR0uX-000245-05 for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:03:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR0uR-0001B4-TM for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:03:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR0uR-0001Ax-MC for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:03:31 -0500 Date: Thu, 26 Feb 2015 13:03:27 -0300 From: Eduardo Habkost Message-ID: <20150226160327.GB3513@thinpad.lan.raisama.net> References: <1424894306-26740-1-git-send-email-ehabkost@redhat.com> <1424894306-26740-6-git-send-email-ehabkost@redhat.com> <54EE47F8.3060001@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <54EE47F8.3060001@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PULL 05/11] target-i386: Eliminate cpu_init() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Peter Maydell , qemu-devel@nongnu.org, Paolo Bonzini On Wed, Feb 25, 2015 at 11:08:56PM +0100, Andreas F=E4rber wrote: > Am 25.02.2015 um 20:58 schrieb Eduardo Habkost: > > Instead of putting extra logic inside cpu.h, just do everything insid= e > > cpu_x86_init_user(). > >=20 > > Reviewed-by: Paolo Bonzini > > Signed-off-by: Eduardo Habkost > > --- > > target-i386/cpu.c | 6 +++--- > > target-i386/cpu.h | 12 +++--------- > > 2 files changed, 6 insertions(+), 12 deletions(-) > >=20 > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index 8f18556..aee4d3e 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -2135,7 +2135,7 @@ out: > > return cpu; > > } > > =20 > > -X86CPU *cpu_x86_init_user(const char *cpu_model) > > +CPUX86State *cpu_x86_init_user(const char *cpu_model) > > { > > Error *error =3D NULL; > > X86CPU *cpu; > > @@ -2153,10 +2153,10 @@ out: > > error_free(error); > > if (cpu !=3D NULL) { > > object_unref(OBJECT(cpu)); > > - cpu =3D NULL; > > } > > + return NULL; > > } > > - return cpu; > > + return &cpu->env; > > } > > =20 > > 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 { > > =20 > > #include "cpu-qom.h" > > =20 > > -X86CPU *cpu_x86_init_user(const char *cpu_model); > > X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridg= e, > > 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 > > =20 > > -static inline CPUX86State *cpu_init(const char *cpu_model) > > -{ > > - X86CPU *cpu =3D cpu_x86_init_user(cpu_model); > > - if (cpu =3D=3D 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 >=20 > The very purpose of this lightweight glue code in cpu.h was to let us > use X86CPU in cpu.c. It seems that you are needlessly reverting my chan= ge? I am not sure I understand what you mean by "let us use X86CPU in cpu.c". But I think the series can be redone without this change, anyway. In either case, what's your plan to eliminate this glue code from the cpu.h files? --=20 Eduardo