qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH-for-5.0] hw/arm/sbsa-ref: Call qdev_get_gpio_in in place


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH-for-5.0] hw/arm/sbsa-ref: Call qdev_get_gpio_in in place
Date: Fri, 6 Dec 2019 17:18:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

On 12/6/19 4:34 PM, Peter Maydell wrote:
On Fri, 6 Dec 2019 at 07:23, Philippe Mathieu-Daudé <address@hidden> wrote:

Instead of filling an array of qemu_irq and passing it around,
directly call qdev_get_gpio_in() on the GIC.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
I accept better patch subject suggestions :)
---
  hw/arm/sbsa-ref.c | 58 +++++++++++++++++++++++------------------------
  1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
index 27046cc284..30cb647551 100644
--- a/hw/arm/sbsa-ref.c
+++ b/hw/arm/sbsa-ref.c
@@ -328,7 +328,7 @@ static void create_secure_ram(SBSAMachineState *sms,
      memory_region_add_subregion(secure_sysmem, base, secram);
  }

-static void create_gic(SBSAMachineState *sms, qemu_irq *pic)
+static DeviceState *create_gic(SBSAMachineState *sms)
  {
      unsigned int smp_cpus = MACHINE(sms)->smp.cpus;
      DeviceState *gicdev;
@@ -403,12 +403,10 @@ static void create_gic(SBSAMachineState *sms, qemu_irq 
*pic)
                             qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
      }

-    for (i = 0; i < NUM_IRQS; i++) {
-        pic[i] = qdev_get_gpio_in(gicdev, i);
-    }
+    return gicdev;

If you make DeviceState *gic a field in SBSAMachineState then
you don't need to pass it in as a parameter to all these
functions. I think this code is mostly borrowed from the
virt board, which is written the way it is because at the
time we didn't have machine state structs which could
own all the device structs etc for the devices on the board.

Great idea, thanks!




reply via email to

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