Convert the *_orphan() device-creation calls in hw/avr 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): file:line | parent | name | rationale atmega.c:287 | OBJECT(dev) | "io" | unimplemented I/O placeholder is a fixed child of the Atmega SoC; SoC realize() creates it, SoC owns it Link: https://lore.kernel.org/qemu-devel/[email protected]/ Assisted-by: Kiro Signed-off-by: Alexander Graf <[email protected]> --- hw/avr/atmega.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c index a85bdf929a..5eb640f628 100644 --- a/hw/avr/atmega.c +++ b/hw/avr/atmega.c @@ -284,10 +284,10 @@ static void atmega_realize(DeviceState *dev, Error **errp) * 0x20 - 0x5f: I/O memory * 0x60 - 0xff: Extended I/O */ - s->io = qdev_new_orphan(TYPE_UNIMPLEMENTED_DEVICE); + s->io = qdev_new(OBJECT(dev), "io", TYPE_UNIMPLEMENTED_DEVICE); qdev_prop_set_string(s->io, "name", "I/O"); qdev_prop_set_uint64(s->io, "size", mc->io_size); - sysbus_realize_and_unref(SYS_BUS_DEVICE(s->io), &error_fatal); + sysbus_realize(SYS_BUS_DEVICE(s->io), &error_fatal); sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->io), 0, OFFSET_DATA, -1234); /* Power Reduction */ -- 2.47.1
