From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
"Eduardo Habkost" <eduardo@habkost.net>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH 7/7] hw: Simplify using sysbus_init_irqs() [manual]
Date: Thu, 01 Jun 2023 07:59:34 +0200 [thread overview]
Message-ID: <87mt1jafjt.fsf@pond.sub.org> (raw)
In-Reply-To: <20230531223341.34827-8-philmd@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Thu, 1 Jun 2023 00:33:41 +0200")
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Audit the sysbus_init_irq() calls and manually convert
> to sysbus_init_irqs() when a loop is involved.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/intc/loongarch_extioi.c | 3 +--
> hw/intc/omap_intc.c | 3 +--
> hw/pci-host/gpex.c | 2 +-
> hw/timer/renesas_tmr.c | 9 +++------
> 4 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
> index db941de20e..c579636215 100644
> --- a/hw/intc/loongarch_extioi.c
> +++ b/hw/intc/loongarch_extioi.c
> @@ -275,8 +275,7 @@ static void loongarch_extioi_instance_init(Object *obj)
> LoongArchExtIOI *s = LOONGARCH_EXTIOI(obj);
> int cpu, pin;
>
> - sysbus_init_irqs(SYS_BUS_DEVICE(dev), s->irq, EXTIOI_IRQS);
> -
> + sysbus_init_irqs(dev, s->irq, EXTIOI_IRQS);
Commit message claims "when a loop is involved". No loop here. That
work was actually done in the previous patch:
diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
index 0e7a3e32f3..db941de20e 100644
--- a/hw/intc/loongarch_extioi.c
+++ b/hw/intc/loongarch_extioi.c
@@ -273,11 +273,9 @@ static void loongarch_extioi_instance_init(Object *obj)
{
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
LoongArchExtIOI *s = LOONGARCH_EXTIOI(obj);
- int i, cpu, pin;
+ int cpu, pin;
- for (i = 0; i < EXTIOI_IRQS; i++) {
- sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq[i]);
- }
+ sysbus_init_irqs(SYS_BUS_DEVICE(dev), s->irq, EXTIOI_IRQS);
qdev_init_gpio_in(DEVICE(obj), extioi_setirq, EXTIOI_IRQS);
In this patch, you merely delete a superfluous type conversion that is
present even before your series.
There are more of them in this function. Please delete them all, and in
a separate patch.
Actually, there are more elsewhere. Coccinelle script
@@
typedef SysBusDevice;
SysBusDevice *dev;
@@
- SYS_BUS_DEVICE(dev)
+ dev
finds some in hw/arm/xlnx-versal.c and hw/rx/rx62n.c, too.
Would be nice to do this for every QOM type, but I don't know how
without duplicating the semantic patch for each of them. There are
almost 150 uses os OBJECT_DECLARE_TYPE()...
You might want to address this in a separate series, to not delay this
one.
> qdev_init_gpio_in(DEVICE(obj), extioi_setirq, EXTIOI_IRQS);
>
> for (cpu = 0; cpu < EXTIOI_CPUS; cpu++) {
> diff --git a/hw/intc/omap_intc.c b/hw/intc/omap_intc.c
> index 647bf324a8..f324b640e3 100644
> --- a/hw/intc/omap_intc.c
> +++ b/hw/intc/omap_intc.c
> @@ -627,8 +627,7 @@ static void omap2_intc_init(Object *obj)
>
> s->level_only = 1;
> s->nbanks = 3;
> - sysbus_init_irq(sbd, &s->parent_intr[0]);
> - sysbus_init_irq(sbd, &s->parent_intr[1]);
> + sysbus_init_irqs(sbd, s->parent_intr, ARRAY_SIZE(s->parent_intr));
Unrolled loop. s->parent_intr[] indeed has 2 elements. Okay.
> qdev_init_gpio_in(dev, omap_set_intr_noedge, s->nbanks * 32);
> memory_region_init_io(&s->mmio, obj, &omap2_inth_mem_ops, s,
> "omap2-intc", 0x1000);
[...]
next prev parent reply other threads:[~2023-06-01 5:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 22:33 [PATCH 0/7] hw/sysbus: Add sysbus_init_irqs and reduce SYSBUS_DEVICE_GPIO_IRQ scope Philippe Mathieu-Daudé
2023-05-31 22:33 ` [PATCH 1/7] hw/arm/xlnx-versal: Do not open-code sysbus_connect_irq() Philippe Mathieu-Daudé
2023-06-01 3:02 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 2/7] hw/usb/xlnx: Do not open-code sysbus_pass_irq() Philippe Mathieu-Daudé
2023-06-01 3:04 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 3/7] hw/sysbus: Introduce sysbus_init_irqs() Philippe Mathieu-Daudé
2023-06-01 3:08 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 4/7] hw/usb/hcd-xhci: Use sysbus_init_irqs() Philippe Mathieu-Daudé
2023-06-01 3:09 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 5/7] hw/sysbus: Make SYSBUS_DEVICE_GPIO_IRQ API internal Philippe Mathieu-Daudé
2023-06-01 3:10 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 6/7] hw: Simplify using sysbus_init_irqs() [automatic] Philippe Mathieu-Daudé
2023-06-01 3:11 ` Richard Henderson
2023-05-31 22:33 ` [PATCH 7/7] hw: Simplify using sysbus_init_irqs() [manual] Philippe Mathieu-Daudé
2023-06-01 3:13 ` Richard Henderson
2023-06-01 5:59 ` Markus Armbruster [this message]
2023-06-01 8:58 ` Philippe Mathieu-Daudé
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=87mt1jafjt.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=eduardo@habkost.net \
--cc=marcandre.lureau@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.