Received: from eggs.gnu.org ([208.118.235.92]:52823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlJM2-0004xS-7U for qemu-devel@nongnu.org; Wed, 19 Dec 2012 08:06:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TlJM0-0005Rq-84 for qemu-devel@nongnu.org; Wed, 19 Dec 2012 08:06:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TlJM0-0005RN-1A for qemu-devel@nongnu.org; Wed, 19 Dec 2012 08:06:32 -0500 Date: Wed, 19 Dec 2012 11:07:59 -0200 From: Eduardo Habkost Message-ID: <20121219130759.GM3236@otherpad.lan.raisama.net> References: <1355879035-21064-1-git-send-email-afaerber@suse.de> <20121219140032.7d875fdf@nial.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20121219140032.7d875fdf@nial.usersys.redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-cpu v2] cpu: Introduce CPUListState struct List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Peter Maydell , Paul Brook , Richard Henderson , Andreas =?iso-8859-1?Q?F=E4rber?= , qemu-devel@nongnu.org On Wed, Dec 19, 2012 at 02:00:32PM +0100, Igor Mammedov wrote: > On Wed, 19 Dec 2012 02:03:55 +0100 > Andreas F=E4rber wrote: >=20 > > This generalizes {ARM,M68k,Alpha}CPUListState to avoid declaring it f= or > > each target. Place it in cpu-common.h to avoid circular dependencies. > >=20 > > Signed-off-by: Andreas F=E4rber > > Cc: Eduardo Habkost > > Cc: Igor Mammedov Reviewed-by: Eduardo Habkost > > --- > > cpu-common.h | 12 ++++++++++++ > > target-alpha/cpu.c | 9 ++------- > > target-arm/helper.c | 9 ++------- > > target-m68k/helper.c | 9 ++------- > > 4 Dateien ge=E4ndert, 18 Zeilen hinzugef=FCgt(+), 21 Zeilen entfernt= (-) > >=20 > > diff --git a/cpu-common.h b/cpu-common.h > > index d2fbafa..a62b6ea 100644 > > --- a/cpu-common.h > > +++ b/cpu-common.h > > @@ -12,6 +12,18 @@ > > #include "bswap.h" > > #include "qemu-queue.h" > > =20 > > +/** > > + * CPUListState: > > + * @cpu_fprintf: Print function. > > + * @file: File to print to using @cpu_fprint. > > + * > > + * State commonly used for iterating over CPU models. > > + */ > > +typedef struct CPUListState { > > + fprintf_function cpu_fprintf; > > + FILE *file; > > +} CPUListState; > > + > > #if !defined(CONFIG_USER_ONLY) > > =20 > > enum device_endian { > > diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c > > index 2deb3c1..59d8669 100644 > > --- a/target-alpha/cpu.c > > +++ b/target-alpha/cpu.c > > @@ -33,11 +33,6 @@ static void alpha_cpu_realize(Object *obj, Error *= *errp) > > #endif > > } > > =20 > > -typedef struct AlphaCPUListState { > > - fprintf_function cpu_fprintf; > > - FILE *file; > > -} AlphaCPUListState; > > - > > /* Sort alphabetically by type name. */ > > static gint alpha_cpu_list_compare(gconstpointer a, gconstpointer b) > > { > > @@ -53,7 +48,7 @@ static gint alpha_cpu_list_compare(gconstpointer a, > > gconstpointer b) static void alpha_cpu_list_entry(gpointer data, gpoi= nter > > user_data) { > > ObjectClass *oc =3D data; > > - AlphaCPUListState *s =3D user_data; > > + CPUListState *s =3D user_data; > > =20 > > (*s->cpu_fprintf)(s->file, " %s\n", > > object_class_get_name(oc)); > > @@ -61,7 +56,7 @@ static void alpha_cpu_list_entry(gpointer data, gpo= inter > > user_data)=20 > > void alpha_cpu_list(FILE *f, fprintf_function cpu_fprintf) > > { > > - AlphaCPUListState s =3D { > > + CPUListState s =3D { > > .file =3D f, > > .cpu_fprintf =3D cpu_fprintf, > > }; > > diff --git a/target-arm/helper.c b/target-arm/helper.c > > index ab8b734..d2f2fb4 100644 > > --- a/target-arm/helper.c > > +++ b/target-arm/helper.c > > @@ -1291,11 +1291,6 @@ ARMCPU *cpu_arm_init(const char *cpu_model) > > return cpu; > > } > > =20 > > -typedef struct ARMCPUListState { > > - fprintf_function cpu_fprintf; > > - FILE *file; > > -} ARMCPUListState; > > - > > /* Sort alphabetically by type name, except for "any". */ > > static gint arm_cpu_list_compare(gconstpointer a, gconstpointer b) > > { > > @@ -1317,7 +1312,7 @@ static gint arm_cpu_list_compare(gconstpointer = a, > > gconstpointer b) static void arm_cpu_list_entry(gpointer data, gpoint= er > > user_data) { > > ObjectClass *oc =3D data; > > - ARMCPUListState *s =3D user_data; > > + CPUListState *s =3D user_data; > > =20 > > (*s->cpu_fprintf)(s->file, " %s\n", > > object_class_get_name(oc)); > > @@ -1325,7 +1320,7 @@ static void arm_cpu_list_entry(gpointer data, > > gpointer user_data)=20 > > void arm_cpu_list(FILE *f, fprintf_function cpu_fprintf) > > { > > - ARMCPUListState s =3D { > > + CPUListState s =3D { > > .file =3D f, > > .cpu_fprintf =3D cpu_fprintf, > > }; > > diff --git a/target-m68k/helper.c b/target-m68k/helper.c > > index a5d0100..875a71a 100644 > > --- a/target-m68k/helper.c > > +++ b/target-m68k/helper.c > > @@ -25,11 +25,6 @@ > > =20 > > #define SIGNBIT (1u << 31) > > =20 > > -typedef struct M68kCPUListState { > > - fprintf_function cpu_fprintf; > > - FILE *file; > > -} M68kCPUListState; > > - > > /* Sort alphabetically, except for "any". */ > > static gint m68k_cpu_list_compare(gconstpointer a, gconstpointer b) > > { > > @@ -51,7 +46,7 @@ static gint m68k_cpu_list_compare(gconstpointer a, > > gconstpointer b) static void m68k_cpu_list_entry(gpointer data, gpoin= ter > > user_data) { > > ObjectClass *c =3D data; > > - M68kCPUListState *s =3D user_data; > > + CPUListState *s =3D user_data; > > =20 > > (*s->cpu_fprintf)(s->file, "%s\n", > > object_class_get_name(c)); > > @@ -59,7 +54,7 @@ static void m68k_cpu_list_entry(gpointer data, gpoi= nter > > user_data)=20 > > void m68k_cpu_list(FILE *f, fprintf_function cpu_fprintf) > > { > > - M68kCPUListState s =3D { > > + CPUListState s =3D { > > .file =3D f, > > .cpu_fprintf =3D cpu_fprintf, > > }; >=20 > Reviewed-By: Igor Mammedov --=20 Eduardo