From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdDUP-0000Cg-6A for qemu-devel@nongnu.org; Sat, 19 Sep 2015 04:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZdDUL-0005kS-Gl for qemu-devel@nongnu.org; Sat, 19 Sep 2015 04:27:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:51421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdDUL-0005jT-7a for qemu-devel@nongnu.org; Sat, 19 Sep 2015 04:27:17 -0400 References: <1441391829-28017-1-git-send-email-ehabkost@redhat.com> <1441391829-28017-7-git-send-email-ehabkost@redhat.com> <55FD1921.5050903@suse.de> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <55FD1C62.7060402@suse.de> Date: Sat, 19 Sep 2015 10:27:14 +0200 MIME-Version: 1.0 In-Reply-To: <55FD1921.5050903@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 6/7] Use DEFINE_MACHINE to register all machines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Peter Maydell , Jean-Christophe Dubois , Marcel Apfelbaum Am 19.09.2015 um 10:13 schrieb Andreas F=C3=A4rber: > Am 04.09.2015 um 20:37 schrieb Eduardo Habkost: >> Convert all machines to use DEFINE_MACHINE instead of QEMUMachine >> automatically using a script. >> >> Cc: Richard Henderson >> Cc: Peter Maydell >> Cc: Li Guang >> Cc: Antony Pavlov >> Cc: Evgeny Voevodin >> Cc: Maksim Kozlov >> Cc: Igor Mitsyanko >> Cc: Dmitry Solodkiy >> Cc: Rob Herring >> Cc: Peter Chubb >> Cc: Jan Kiszka >> Cc: Andrzej Zaborowski >> Cc: Peter Crosthwaite >> Cc: "Edgar E. Iglesias" >> Cc: Michael Walle >> Cc: Aurelien Jarno >> Cc: Leon Alrae >> Cc: "Herv=C3=A9 Poussineau" >> Cc: Jia Liu >> Cc: Alexander Graf >> Cc: Scott Wood >> Cc: "Andreas F=C3=A4rber" >> Cc: Magnus Damm >> Cc: Fabien Chouteau >> Cc: Blue Swirl >> Cc: Mark Cave-Ayland >> Cc: Bastian Koppelmann >> Cc: Guan Xuetao >> Cc: Max Filippov >> Cc: qemu-ppc@nongnu.org >> Signed-off-by: Eduardo Habkost >> --- >> Changes v1 -> v2: >> * Fix trailing spaces and newlines >> * Don't touch "//" comments on lines that we are not changing >> * Break long lines manually >> >> Changes v2 -> v3: >> * Replace "machine_machine" with "machine" in new variable and functio= n >> names. >> Suggested-by: Michael Walle >> * Eliminate empty mips_malta_machine_init() and sun4u_machine_init() >> functions >=20 > In most (but not all) cases the last DEFINE_MACHINE(...) added a white > line, dropped manually. >=20 > Your script also always added a semicolon after DEFINE_MACHINE(), even > when the original machine_init() did not have it. Cleaned up manually. >=20 > This scripted approach also regresses files with multiple machines to > now have one module init function per machine rather than one per file. >=20 > I'm also not clear on why you chose to diverge from devices in having a > machine-specific init function with MachineClass *mc arg rather than > having ObjectClass *oc, void *data and having a local mc variable. >=20 > But getting this conversion done to drop the old infrastructure seems > more important, and this can be revisited afterwards. The following conversion has become necessary on top (squashing): diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index c34667f..4250114 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -145,15 +145,10 @@ static void imx25_pdk_init(MachineState *machine) } } -static QEMUMachine imx25_pdk_machine =3D { - .name =3D "imx25_pdk", - .desc =3D "ARM i.MX25 PDK board (ARM926)", - .init =3D imx25_pdk_init, -}; - -static void imx25_pdk_machine_init(void) +static void imx25_pdk_machine_init(MachineClass *mc) { - qemu_register_machine(&imx25_pdk_machine); + mc->desc =3D "ARM i.MX25 PDK board (ARM926)"; + mc->init =3D imx25_pdk_init; } -machine_init(imx25_pdk_machine_init) Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N= =C3=BCrnberg)