qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/7] hw: Simplify using sysbus_init_irqs() [manual]


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 7/7] hw: Simplify using sysbus_init_irqs() [manual]
Date: Thu, 1 Jun 2023 10:58:53 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 1/6/23 07:59, Markus Armbruster wrote:
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.

Right. I guess I did that automatically "why are we casting the same
type?" without even noticing.

There are more of them in this function.  Please delete them all, and in
a separate patch.

OK.

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()...

Checking all QOM macros, I counted 1076 types...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]