From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Juraj Marcin" <jmarcin@redhat.com>,
peterx@redhat.com, "Daniel P . Berrangé" <berrange@redhat.com>,
"Fabiano Rosas" <farosas@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Cédric Le Goater" <clg@redhat.com>,
"Eduardo Habkost" <eduardo@habkost.net>
Subject: [PATCH v2 10/13] qom: Use machine_get_container()
Date: Thu, 21 Nov 2024 14:21:59 -0500 [thread overview]
Message-ID: <20241121192202.4155849-11-peterx@redhat.com> (raw)
In-Reply-To: <20241121192202.4155849-1-peterx@redhat.com>
Use machine_get_container() whenever applicable across the tree.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
hw/core/gpio.c | 3 +--
hw/core/qdev.c | 3 +--
hw/core/sysbus.c | 4 ++--
hw/i386/pc.c | 4 ++--
system/ioport.c | 2 +-
system/memory.c | 2 +-
system/qdev-monitor.c | 6 +++---
system/vl.c | 3 +--
8 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/hw/core/gpio.c b/hw/core/gpio.c
index 80d07a6ec9..6e32a8eec6 100644
--- a/hw/core/gpio.c
+++ b/hw/core/gpio.c
@@ -121,8 +121,7 @@ void qdev_connect_gpio_out_named(DeviceState *dev, const char *name, int n,
name ? name : "unnamed-gpio-out", n);
if (input_pin && !OBJECT(input_pin)->parent) {
/* We need a name for object_property_set_link to work */
- object_property_add_child(container_get(qdev_get_machine(),
- "/unattached"),
+ object_property_add_child(machine_get_container("unattached"),
"non-qdev-gpio[*]", OBJECT(input_pin));
}
object_property_set_link(OBJECT(dev), propname,
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index fa3bc85d9a..d52b669355 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -476,8 +476,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
if (!obj->parent) {
gchar *name = g_strdup_printf("device[%d]", unattached_count++);
- object_property_add_child(container_get(qdev_get_machine(),
- "/unattached"),
+ object_property_add_child(machine_get_container("unattached"),
name, obj);
unattached_parent = true;
g_free(name);
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index e64d99c8ed..9355849ff0 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -65,9 +65,9 @@ void foreach_dynamic_sysbus_device(FindSysbusDeviceFunc *func, void *opaque)
};
/* Loop through all sysbus devices that were spawned outside the machine */
- container = container_get(qdev_get_machine(), "/peripheral");
+ container = machine_get_container("peripheral");
find_sysbus_device(container, &find);
- container = container_get(qdev_get_machine(), "/peripheral-anon");
+ container = machine_get_container("peripheral-anon");
find_sysbus_device(container, &find);
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 317aaca25a..b8ec2506e1 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -460,7 +460,7 @@ static int check_fdc(Object *obj, void *opaque)
}
static const char * const fdc_container_path[] = {
- "/unattached", "/peripheral", "/peripheral-anon"
+ "unattached", "peripheral", "peripheral-anon"
};
/*
@@ -474,7 +474,7 @@ static ISADevice *pc_find_fdc0(void)
CheckFdcState state = { 0 };
for (i = 0; i < ARRAY_SIZE(fdc_container_path); i++) {
- container = container_get(qdev_get_machine(), fdc_container_path[i]);
+ container = machine_get_container(fdc_container_path[i]);
object_child_foreach(container, check_fdc, &state);
}
diff --git a/system/ioport.c b/system/ioport.c
index fd551d0375..55c2a75239 100644
--- a/system/ioport.c
+++ b/system/ioport.c
@@ -258,7 +258,7 @@ static void portio_list_add_1(PortioList *piolist,
object_ref(&mrpio->mr);
object_unparent(OBJECT(&mrpio->mr));
if (!piolist->owner) {
- owner = container_get(qdev_get_machine(), "/unattached");
+ owner = machine_get_container("unattached");
} else {
owner = piolist->owner;
}
diff --git a/system/memory.c b/system/memory.c
index 85f6834cb3..fba351b030 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -1238,7 +1238,7 @@ static void memory_region_do_init(MemoryRegion *mr,
char *name_array = g_strdup_printf("%s[*]", escaped_name);
if (!owner) {
- owner = container_get(qdev_get_machine(), "/unattached");
+ owner = machine_get_container("unattached");
}
object_property_add_child(owner, name_array, OBJECT(mr));
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 4c09b38ffb..4d46af2c8d 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -348,7 +348,7 @@ static Object *qdev_get_peripheral(void)
static Object *dev;
if (dev == NULL) {
- dev = container_get(qdev_get_machine(), "/peripheral");
+ dev = machine_get_container("peripheral");
}
return dev;
@@ -359,7 +359,7 @@ static Object *qdev_get_peripheral_anon(void)
static Object *dev;
if (dev == NULL) {
- dev = container_get(qdev_get_machine(), "/peripheral-anon");
+ dev = machine_get_container("peripheral-anon");
}
return dev;
@@ -1085,7 +1085,7 @@ static GSList *qdev_build_hotpluggable_device_list(Object *peripheral)
static void peripheral_device_del_completion(ReadLineState *rs,
const char *str)
{
- Object *peripheral = container_get(qdev_get_machine(), "/peripheral");
+ Object *peripheral = machine_get_container("peripheral");
GSList *list, *item;
list = qdev_build_hotpluggable_device_list(peripheral);
diff --git a/system/vl.c b/system/vl.c
index 15e35162c6..cdc0b6e10c 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2136,8 +2136,7 @@ static void qemu_create_machine(QDict *qdict)
object_property_add_child(object_get_root(), "machine",
OBJECT(current_machine));
qemu_create_machine_containers(OBJECT(current_machine));
- object_property_add_child(container_get(OBJECT(current_machine),
- "/unattached"),
+ object_property_add_child(machine_get_container("unattached"),
"sysbus", OBJECT(sysbus_get_default()));
if (machine_class->minimum_page_bits) {
--
2.45.0
next prev parent reply other threads:[~2024-11-21 19:23 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-21 19:21 [PATCH v2 00/13] QOM: container_get() removal Peter Xu
2024-11-21 19:21 ` [PATCH v2 01/13] qom: Add TYPE_CONTAINER macro Peter Xu
2024-11-21 19:21 ` [PATCH v2 02/13] qom: New object_property_add_new_container() Peter Xu
2024-11-21 20:21 ` Philippe Mathieu-Daudé
2024-11-22 14:12 ` Markus Armbruster
2024-11-21 19:21 ` [PATCH v2 03/13] tests: Fix test-qdev-global-props on anonymous qdev realize() Peter Xu
2024-11-21 19:21 ` [PATCH v2 04/13] tests: Explicitly create containers in test_qom_partial_path() Peter Xu
2024-11-21 19:21 ` [PATCH v2 05/13] ppc/e500: Avoid abuse of container_get() Peter Xu
2024-11-21 19:21 ` [PATCH v2 06/13] hw/ppc: Explicitly create the drc container Peter Xu
2024-11-21 20:20 ` Philippe Mathieu-Daudé
2024-11-21 19:21 ` [PATCH v2 07/13] qom: Create system containers explicitly Peter Xu
2024-11-21 20:19 ` Philippe Mathieu-Daudé
2024-11-21 19:21 ` [PATCH v2 08/13] qdev: Make qdev_get_machine() not use container_get() Peter Xu
2024-11-21 20:21 ` Philippe Mathieu-Daudé
2024-12-19 18:20 ` Philippe Mathieu-Daudé
2024-12-19 18:27 ` Philippe Mathieu-Daudé
2024-12-20 11:25 ` Philippe Mathieu-Daudé
2024-12-20 17:24 ` Peter Xu
2024-12-20 21:38 ` Philippe Mathieu-Daudé
2024-12-23 17:29 ` Peter Xu
2024-11-21 19:21 ` [PATCH v2 09/13] qdev: Add machine_get_container() Peter Xu
2024-11-21 19:21 ` Peter Xu [this message]
2024-11-21 20:16 ` [PATCH v2 10/13] qom: Use machine_get_container() Philippe Mathieu-Daudé
2025-01-02 13:58 ` Philippe Mathieu-Daudé
2024-11-21 19:22 ` [PATCH v2 11/13] qom: Add object_get_container() Peter Xu
2024-11-21 19:22 ` [PATCH v2 12/13] qom: Use object_get_container() Peter Xu
2024-11-21 20:15 ` Philippe Mathieu-Daudé
2024-11-21 19:22 ` [PATCH v2 13/13] qom: Remove container_get() Peter Xu
2024-11-21 20:14 ` Philippe Mathieu-Daudé
2024-12-19 17:29 ` [PATCH v2 00/13] QOM: container_get() removal Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241121192202.4155849-11-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=clg@redhat.com \
--cc=eduardo@habkost.net \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).