From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Marcel Apfelbaum <marcel.a@redhat.com>,
Jean-Christophe Dubois <jcd@tribudubois.net>
Subject: Re: [Qemu-devel] [PATCH v3 6/7] Use DEFINE_MACHINE to register all machines
Date: Sat, 19 Sep 2015 10:28:38 +0200 [thread overview]
Message-ID: <55FD1CB6.5000704@suse.de> (raw)
In-Reply-To: <55FD1C62.7060402@suse.de>
Am 19.09.2015 um 10:27 schrieb Andreas Färber:
> 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 <rth@twiddle.net>
>>> Cc: Peter Maydell <peter.maydell@linaro.org>
>>> Cc: Li Guang <lig.fnst@cn.fujitsu.com>
>>> Cc: Antony Pavlov <antonynpavlov@gmail.com>
>>> Cc: Evgeny Voevodin <e.voevodin@samsung.com>
>>> Cc: Maksim Kozlov <m.kozlov@samsung.com>
>>> Cc: Igor Mitsyanko <i.mitsyanko@gmail.com>
>>> Cc: Dmitry Solodkiy <d.solodkiy@samsung.com>
>>> Cc: Rob Herring <robh@kernel.org>
>>> Cc: Peter Chubb <peter.chubb@nicta.com.au>
>>> Cc: Jan Kiszka <jan.kiszka@web.de>
>>> Cc: Andrzej Zaborowski <balrogg@gmail.com>
>>> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
>>> Cc: Michael Walle <michael@walle.cc>
>>> Cc: Aurelien Jarno <aurelien@aurel32.net>
>>> Cc: Leon Alrae <leon.alrae@imgtec.com>
>>> Cc: "Hervé Poussineau" <hpoussin@reactos.org>
>>> Cc: Jia Liu <proljc@gmail.com>
>>> Cc: Alexander Graf <agraf@suse.de>
>>> Cc: Scott Wood <scottwood@freescale.com>
>>> Cc: "Andreas Färber" <andreas.faerber@web.de>
>>> Cc: Magnus Damm <magnus.damm@gmail.com>
>>> Cc: Fabien Chouteau <chouteau@adacore.com>
>>> Cc: Blue Swirl <blauwirbel@gmail.com>
>>> Cc: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>>> Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
>>> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
>>> Cc: Max Filippov <jcmvbkbc@gmail.com>
>>> Cc: qemu-ppc@nongnu.org
>>> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>>> ---
>>> 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 <michael@walle.cc>
>>> * 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):
>
> 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)
+DEFINE_MACHINE("imx25_pdk", imx25_pdk_machine_init)
>
> Regards,
> Andreas
>
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2015-09-19 8:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-04 18:37 [Qemu-devel] [PATCH v3 0/7] machine registration: Use QOM, eliminate QEMUMachine Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 1/7] exynos4: Use EXYNOS4210_NCPUS instead of max_cpus on error message Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 2/7] exynos4: Use MachineClass instead of exynos4_machines array Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 3/7] exynos4: Declare each QEMUMachine as a separate variable Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 4/7] machine: DEFINE_MACHINE macro Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 5/7] mac_world: Break long line Eduardo Habkost
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 6/7] Use DEFINE_MACHINE to register all machines Eduardo Habkost
2015-09-19 8:13 ` Andreas Färber
2015-09-19 8:27 ` Andreas Färber
2015-09-19 8:28 ` Andreas Färber [this message]
2015-09-21 15:10 ` Eduardo Habkost
2015-09-19 12:19 ` [Qemu-devel] [PATCH 6a/7] Revert use of DEFINE_MACHINE() for registrations of multiple machines Andreas Färber
2015-09-04 18:37 ` [Qemu-devel] [PATCH v3 7/7] machine: Eliminate QEMUMachine and qemu_register_machine() Eduardo Habkost
2015-09-19 16:21 ` [Qemu-devel] [PATCH v3 0/7] machine registration: Use QOM, eliminate QEMUMachine Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55FD1CB6.5000704@suse.de \
--to=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=jcd@tribudubois.net \
--cc=marcel.a@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).