Convert the *_orphan() device-creation calls in hw/nvme 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/nvme/ctrl.c:9559 | qdev_new | OBJECT(n) | "subsys" | Called from nvme 
controller realize; the auto-created subsystem is owned by the controller that 
creates it

Link: https://lore.kernel.org/qemu-devel/[email protected]/
Assisted-by: Kiro
Signed-off-by: Alexander Graf <[email protected]>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 300a5aa835..82a55c4536 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -9556,7 +9556,7 @@ static int nvme_init_subsys(NvmeCtrl *n, Error **errp)
     int cntlid;
 
     if (!n->subsys) {
-        DeviceState *dev = qdev_new_orphan(TYPE_NVME_SUBSYS);
+        DeviceState *dev = qdev_new(OBJECT(n), "subsys", TYPE_NVME_SUBSYS);
 
         qdev_prop_set_string(dev, "nqn", n->params.serial);
 
-- 
2.47.1


Reply via email to