mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
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>
This commit is contained in:
parent
41fc917728
commit
1c34335844
8 changed files with 12 additions and 15 deletions
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue