diff options
author | Peter Xu <peterx@redhat.com> | 2024-11-21 14:21:59 -0500 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-09 18:16:24 +0100 |
commit | 1c34335844950a152c020ec80ce7cf711b1861bc (patch) | |
tree | 78ca12c4d57c25cad2c6ec32b7afc4142de9fc88 /hw | |
parent | 41fc91772841c93c218df78d7e359cb2cd00dff5 (diff) | |
download | qemu-1c34335844950a152c020ec80ce7cf711b1861bc.zip qemu-1c34335844950a152c020ec80ce7cf711b1861bc.tar.gz qemu-1c34335844950a152c020ec80ce7cf711b1861bc.tar.bz2 |
qdev: Use machine_get_container()
Use machine_get_container() whenever applicable across the tree.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241121192202.4155849-11-peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/gpio.c | 3 | ||||
-rw-r--r-- | hw/core/qdev.c | 3 | ||||
-rw-r--r-- | hw/core/sysbus.c | 4 | ||||
-rw-r--r-- | hw/i386/pc.c | 4 |
4 files changed, 6 insertions, 8 deletions
diff --git a/hw/core/gpio.c b/hw/core/gpio.c index 80d07a6..6e32a8e 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 9abc4e8..82bbdcb 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 e64d99c..9355849 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 7111876..9334b03 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -463,7 +463,7 @@ static int check_fdc(Object *obj, void *opaque) } static const char * const fdc_container_path[] = { - "/unattached", "/peripheral", "/peripheral-anon" + "unattached", "peripheral", "peripheral-anon" }; /* @@ -477,7 +477,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); } |