[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object |
Date: |
Wed, 18 Apr 2012 23:25:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0 |
Am 18.04.2012 22:56, schrieb Anthony Liguori:
> This makes sysbus part of the root hierarchy and all busses children of their
> respective parent DeviceState.
>
> Signed-off-by: Anthony Liguori <address@hidden>
> ---
> hw/qdev.c | 11 +++++------
> qom/object.c | 12 ++++++++++++
> 2 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 26e6f09..b5eef22 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -427,6 +427,7 @@ static void do_qbus_create_inplace(BusState *bus, const
> char *typename,
> if (parent) {
> QLIST_INSERT_HEAD(&parent->child_bus, bus, sibling);
> parent->num_child_bus++;
> + object_property_add_child(OBJECT(parent), bus->name, OBJECT(bus),
> NULL);
> } else if (bus != main_system_bus) {
> /* TODO: once all bus devices are qdevified,
> only reset handler for main_system_bus should be registered here.
> */
> @@ -456,6 +457,8 @@ static void main_system_bus_create(void)
> /* assign main_system_bus before qbus_create_inplace()
> * in order to make "if (bus != main_system_bus)" work */
> main_system_bus = qbus_create(TYPE_SYSTEM_BUS, NULL, "main-system-bus");
> + object_property_add_child(object_get_root(), "sysbus",
> + OBJECT(main_system_bus), NULL);
So this is adding /sysbus. Shouldn't this rather go into
/unassigned/sysbus?
> }
>
> void qbus_free(BusState *bus)
> @@ -537,11 +540,6 @@ char *qdev_get_dev_path(DeviceState *dev)
> return NULL;
> }
>
> -static char *qdev_get_type(Object *obj, Error **errp)
> -{
> - return g_strdup(object_get_typename(obj));
> -}
> -
> /**
> * Legacy property handling
> */
> @@ -657,7 +655,8 @@ static void device_initfn(Object *obj)
>
> qdev_add_properties(dev, dc->props);
>
> - object_property_add_str(OBJECT(dev), "type", qdev_get_type, NULL, NULL);
> + object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS,
> + (Object **)&dev->parent_bus, NULL);
> }
>
> /* Unlink device from bus and free the structure. */
> diff --git a/qom/object.c b/qom/object.c
> index 94928c5..0268f2a 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -256,12 +256,24 @@ static void object_interface_init(Object *obj,
> InterfaceImpl *iface)
> obj->interfaces = g_slist_prepend(obj->interfaces, iface_obj);
> }
>
> +static char *object_get_typename_dup(Object *obj, Error **errp)
> +{
> + return g_strdup(object_get_typename(obj));
> +}
> +
> +static void object_base_init(Object *obj)
> +{
> + object_property_add_str(obj, "type", object_get_typename_dup, NULL,
> NULL);
> +}
> +
> static void object_init_with_type(Object *obj, TypeImpl *ti)
> {
> int i;
>
> if (type_has_parent(ti)) {
> object_init_with_type(obj, type_get_parent(ti));
> + } else {
> + object_base_init(obj);
> }
>
> for (i = 0; i < ti->num_interfaces; i++) {
The move of the "type" property was a standalone patch in Paolo's series
already, so I'd suggest to prepend that here for deduplification.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- [Qemu-devel] [PATCH 00/14] qom: convert busses to QOM, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 01/14] qdev: fix adding of ptr properties, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 02/14] object: add object_property_foreach, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 03/14] qdev: add qdev_add_properties, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 04/14] qdev: don't allow globals to be set by bus name, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 05/14] qdev: use wrapper for qdev_get_path, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 07/14] qdev: fix info qtree/qdm, Anthony Liguori, 2012/04/18
- [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Anthony Liguori, 2012/04/18
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object,
Andreas Färber <=
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Anthony Liguori, 2012/04/18
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Igor Mammedov, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Andreas Färber, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Paolo Bonzini, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Anthony Liguori, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Peter Maydell, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Andreas Färber, 2012/04/19
- Re: [Qemu-devel] [PATCH 09/14] qdev: connect some links and move type to object, Anthony Liguori, 2012/04/19
[Qemu-devel] [PATCH 12/14] qbus: move print_dev to DeviceClass, Anthony Liguori, 2012/04/18
[Qemu-devel] [PATCH 11/14] qbus: move get_fw_dev_path to DeviceClass, Anthony Liguori, 2012/04/18