Convert the *_orphan() device-creation calls in hw/core to the new
parented API introduced earlier in this series, so every onboard
device gets a stable path in the composition tree instead of landing
in /machine/unattached with an unstable device[N] name.

The parent for each device is the object that owns its lifetime: the
machine for board-created devices, the containing device for
composite children.  Names follow existing QOM conventions.

Per-site rationale (reviewers: dispute the modeling here):

hw/core/null-machine.c:28 | cpu_create | OBJECT(mch) | "cpu[*]" | Board init; 
machine owns CPU lifetime
hw/core/qdev.c:167,172 hw/core/sysbus.c:245,254 hw/core/cpu-common.c:71 | 
(definitions) | ORPHAN-JUSTIFIED | - | These are the *_orphan() implementations 
themselves

Link: https://lore.kernel.org/qemu-devel/[email protected]/
AI-used-for: code (refactoring)
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/core/null-machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/null-machine.c b/hw/core/null-machine.c
index 7cc4b9ab3b..ac741bdf06 100644
--- a/hw/core/null-machine.c
+++ b/hw/core/null-machine.c
@@ -25,7 +25,7 @@ static void machine_none_init(MachineState *mch)
 
     /* Initialize CPU (if user asked for it) */
     if (mch->cpu_type) {
-        cpu = cpu_create_orphan(mch->cpu_type);
+        cpu = cpu_create(OBJECT(mch), "cpu[*]", mch->cpu_type);
         if (!cpu) {
             error_report("Unable to initialize CPU");
             exit(1);
-- 
2.47.1


Reply via email to