[RFC PATCH v2 127/137] hw/arm/mps2: Parent the OR-IRQ gates under the machine

Alexander Graf <[email protected]>
Newsgroups org.nongnu.qemu-arm,org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <[email protected]>
The mps2 board creates several TYPE_OR_IRQ gates for UART overflow,
per-UART tx/rx, and SPI interrupts.  Parent them under the machine
so they get canonical paths.  The 282/325 pair sit on
mutually-exclusive switch arms, so a single "uart-orgate" name is
sufficient; the loop-created gates use "[*]" auto-indexing.

AI-used-for: code (refactoring)
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/arm/mps2.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index 1dec4a5d4d..1032f47cb8 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -279,7 +279,7 @@ static void mps2_common_init(MachineState *machine)
         Object *orgate;
         DeviceState *orgate_dev;
 
-        orgate = object_new(TYPE_OR_IRQ);
+        orgate = object_new_child(OBJECT(mms), "uart-orgate", TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 6, &error_fatal);
         qdev_realize(DEVICE(orgate), NULL, &error_fatal);
         orgate_dev = DEVICE(orgate);
@@ -322,7 +322,7 @@ static void mps2_common_init(MachineState *machine)
         Object *orgate;
         DeviceState *orgate_dev;
 
-        orgate = object_new(TYPE_OR_IRQ);
+        orgate = object_new_child(OBJECT(mms), "uart-orgate", TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 10, &error_fatal);
         qdev_realize(DEVICE(orgate), NULL, &error_fatal);
         orgate_dev = DEVICE(orgate);
@@ -338,7 +338,8 @@ static void mps2_common_init(MachineState *machine)
             DeviceState *txrx_orgate_dev, *dev;
             SysBusDevice *s;
 
-            txrx_orgate = object_new(TYPE_OR_IRQ);
+            txrx_orgate = object_new_child(OBJECT(mms), "uart-txrx-orgate[*]",
+                                           TYPE_OR_IRQ);
             object_property_set_int(txrx_orgate, "num-lines", 2, &error_fatal);
             qdev_realize(DEVICE(txrx_orgate), NULL, &error_fatal);
             txrx_orgate_dev = DEVICE(txrx_orgate);
@@ -430,7 +431,7 @@ static void mps2_common_init(MachineState *machine)
         Object *orgate;
         int j;
 
-        orgate = object_new(TYPE_OR_IRQ);
+        orgate = object_new_child(OBJECT(mms), "spi-orgate[*]", TYPE_OR_IRQ);
         object_property_set_int(orgate, "num-lines", 2, &error_fatal);
         orgate_dev = DEVICE(orgate);
         qdev_realize(orgate_dev, NULL, &error_fatal);
-- 
2.47.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.