From patchwork Sat Sep 19 08:27:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 519646 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0AAA5140216 for ; Sat, 19 Sep 2015 18:27:40 +1000 (AEST) Received: from localhost ([::1]:44410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdDUg-0000Ti-4V for incoming@patchwork.ozlabs.org; Sat, 19 Sep 2015 04:27:38 -0400 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 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E6DB9AC04; Sat, 19 Sep 2015 08:27:15 +0000 (UTC) To: Eduardo Habkost , qemu-devel@nongnu.org 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?= Organization: SUSE Linux GmbH Message-ID: <55FD1C62.7060402@suse.de> Date: Sat, 19 Sep 2015 10:27:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <55FD1921.5050903@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 Cc: Peter Maydell , Jean-Christophe Dubois , Marcel Apfelbaum Subject: Re: [Qemu-devel] [PATCH v3 6/7] Use DEFINE_MACHINE to register all machines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 19.09.2015 um 10:13 schrieb Andreas Färber: > 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é Poussineau" >> Cc: Jia Liu >> Cc: Alexander Graf >> Cc: Scott Wood >> Cc: "Andreas Färber" >> 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 function >> names. >> Suggested-by: Michael Walle >> * Eliminate empty mips_malta_machine_init() and sun4u_machine_init() >> functions > > In most (but not all) cases the last DEFINE_MACHINE(...) added a white > line, dropped manually. > > Your script also always added a semicolon after DEFINE_MACHINE(), even > when the original machine_init() did not have it. Cleaned up manually. > > This scripted approach also regresses files with multiple machines to > now have one module init function per machine rather than one per file. > > 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. > > 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): Regards, Andreas 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 = { - .name = "imx25_pdk", - .desc = "ARM i.MX25 PDK board (ARM926)", - .init = 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 = "ARM i.MX25 PDK board (ARM926)"; + mc->init = imx25_pdk_init; } -machine_init(imx25_pdk_machine_init)