From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-devel@nongnu.org
Cc: Igor Mammedov <imammedo@redhat.com>,
qemu-arm@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
Eduardo Habkost <eduardo@habkost.net>,
Markus Armbruster <armbru@redhat.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
Andrew Jeffery <andrew@aj.id.au>, Joel Stanley <joel@jms.id.au>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
Alistair Francis <alistair@alistair23.me>,
Bin Meng <bin.meng@windriver.com>,
Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>,
qemu-block@nongnu.org
Subject: Re: [PATCH 1/1] hw/sd: Declare CPU QOM types using DEFINE_TYPES() macro
Date: Wed, 8 Nov 2023 11:39:48 +0100 [thread overview]
Message-ID: <1a89ee9c-bd1c-4a04-8163-38307156351f@linaro.org> (raw)
In-Reply-To: <b06b0685-9407-4350-a8e6-edd0a9411c4e@kaod.org>
On 31/10/23 09:31, Cédric Le Goater wrote:
> On 10/31/23 09:06, Philippe Mathieu-Daudé wrote:
>> When multiple QOM types are registered in the same file,
>> it is simpler to use the the DEFINE_TYPES() macro. In
>> particular because type array declared with such macro
>> are easier to review.
>>
>> Mechanical transformation using the following comby script:
>>
>> [pattern-x1]
>> match='''
>> static const TypeInfo :[i1~.*_info] = {
>> :[body]
>> };
>> static void :[rt1~.*_register_type.](void)
>> {
>> type_register_static(&:[i2~.*_info]);
>> }
>> type_init(:[rt2~.*_register_type.])
>> '''
>> rewrite='''
>> static const TypeInfo :[i1][] = {
>> {
>> :[body]
>> },
>> };
>>
>> DEFINE_TYPES(:[i1])
>> '''
>> rule='where :[i1] == :[i2], :[rt1] == :[rt2]'
>>
>> [pattern-x2]
>> match='''
>> static const TypeInfo :[i1a~.*_info] = {
>> :[body1]
>> };
>> ...
>> static const TypeInfo :[i2a~.*_info] = {
>> :[body2]
>> };
>> static void :[rt1~.*_register_type.](void)
>> {
>> type_register_static(&:[i1b~.*_info]);
>> type_register_static(&:[i2b~.*_info]);
>> }
>> type_init(:[rt2~.*_register_type.])
>> '''
>> rewrite='''
>> static const TypeInfo :[i1a][] = {
>> {
>> :[body1]
>> },
>> {
>> :[body2]
>> },
>> };
>>
>> DEFINE_TYPES(:[i1a])
>> '''
>> rule='''
>> where
>> :[i1a] == :[i1b],
>> :[i2a] == :[i2b],
>> :[rt1] == :[rt2]
>> '''
>>
>> and re-indented manually.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> I checked the aspeed part.
>
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
In the absence of other reviews, I'm queueing this patch via my cpu/misc
tree, thanks!
>> ---
>> hw/sd/aspeed_sdhci.c | 19 ++++++++-----------
>> hw/sd/bcm2835_sdhost.c | 33 ++++++++++++++-------------------
>> hw/sd/cadence_sdhci.c | 21 +++++++++------------
>> hw/sd/core.c | 19 ++++++++-----------
>> hw/sd/npcm7xx_sdhci.c | 21 +++++++++------------
>> hw/sd/pl181.c | 35 +++++++++++++++--------------------
>> hw/sd/pxa2xx_mmci.c | 35 +++++++++++++++--------------------
>> hw/sd/sd.c | 37 ++++++++++++++++---------------------
>> hw/sd/sdhci-pci.c | 25 +++++++++++--------------
>> hw/sd/ssi-sd.c | 19 ++++++++-----------
>> 10 files changed, 113 insertions(+), 151 deletions(-)
prev parent reply other threads:[~2023-11-08 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-31 8:06 [PATCH 0/1] hw/sd: Declare CPU QOM types using DEFINE_TYPES() macro Philippe Mathieu-Daudé
2023-10-31 8:06 ` [PATCH 1/1] " Philippe Mathieu-Daudé
2023-10-31 8:31 ` Cédric Le Goater
2023-11-08 10:39 ` Philippe Mathieu-Daudé [this message]
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=1a89ee9c-bd1c-4a04-8163-38307156351f@linaro.org \
--to=philmd@linaro.org \
--cc=alistair@alistair23.me \
--cc=andrew@aj.id.au \
--cc=armbru@redhat.com \
--cc=bin.meng@windriver.com \
--cc=clg@kaod.org \
--cc=edgar.iglesias@gmail.com \
--cc=eduardo@habkost.net \
--cc=imammedo@redhat.com \
--cc=joel@jms.id.au \
--cc=kfting@nuvoton.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wuhaotsh@google.com \
/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).