qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: David Gibson <david@gibson.dropbear.id.au>,
	mdroth@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com
Cc: pbonzini@redhat.com, qemu-ppc@nongnu.org, agraf@suse.de,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFCv2 1/2] spapr: Remove unnecessary owner field from sPAPRDRConnector
Date: Mon, 14 Sep 2015 18:22:35 +1000	[thread overview]
Message-ID: <55F683CB.6000508@ozlabs.ru> (raw)
In-Reply-To: <1442194913-26545-2-git-send-email-david@gibson.dropbear.id.au>

On 09/14/2015 11:41 AM, David Gibson wrote:
> The sPAPRDRConnector pseudo-device contains an owner field which is
> set in spapr_dr_connector_new().  However, that function also calls
> object_property_add_child() to set the DRConnector as the QOM child of
> the owner object.  That means that owner is always the same as the QOM
> parent, and so redundant.
>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
>   hw/ppc/spapr_drc.c         | 5 ++---
>   include/hw/ppc/spapr_drc.h | 1 -
>   2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
> index 9ce844a..68e0c3e 100644
> --- a/hw/ppc/spapr_drc.c
> +++ b/hw/ppc/spapr_drc.c
> @@ -416,7 +416,7 @@ static void realize(DeviceState *d, Error **errp)
>       child_name = object_get_canonical_path_component(OBJECT(drc));
>       DPRINTFN("drc child name: %s", child_name);
>       object_property_add_alias(root_container, link_name,
> -                              drc->owner, child_name, &err);
> +                              OBJECT(drc)->parent, child_name, &err);
>       if (err) {
>           error_report("%s", error_get_pretty(err));
>           error_free(err);
> @@ -456,7 +456,6 @@ sPAPRDRConnector *spapr_dr_connector_new(Object *owner,
>
>       drc->type = type;
>       drc->id = id;
> -    drc->owner = owner;
>       object_property_add_child(owner, "dr-connector[*]", OBJECT(drc), NULL);


The comment for object_property_add_child() in include/qom/object.h says:

===
* There is no way for a child to determine what its parent is.  It is not
* a bidirectional relationship.  This is by design.
===

This part always confused me as there is "Object *parent" in the "struct 
Object". So there is way to determine but it must not be used? Is it debug 
only?

Anyway, all members of the Object class are under /*< private >*/ so they 
should not be accesses in sPAPR code, I believe.



>       object_property_set_bool(OBJECT(drc), true, "realized", NULL);
>
> @@ -669,7 +668,7 @@ int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner,
>           drc = SPAPR_DR_CONNECTOR(obj);
>           drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc);
>
> -        if (owner && (drc->owner != owner)) {
> +        if (owner && (OBJECT(drc)->parent != owner)) {
>               continue;
>           }
>
> diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
> index 28ffeae..16e2d4b 100644
> --- a/include/hw/ppc/spapr_drc.h
> +++ b/include/hw/ppc/spapr_drc.h
> @@ -137,7 +137,6 @@ typedef struct sPAPRDRConnector {
>
>       sPAPRDRConnectorType type;
>       uint32_t id;
> -    Object *owner;
>       const char *name;
>
>       /* sensor/indicator states */
>


-- 
Alexey

  parent reply	other threads:[~2015-09-14  8:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  1:41 [Qemu-devel] [RFCv2 0/2] spapr: Cleanups to dynamic reconfiguration mechanism David Gibson
2015-09-14  1:41 ` [Qemu-devel] [RFCv2 1/2] spapr: Remove unnecessary owner field from sPAPRDRConnector David Gibson
2015-09-14  6:23   ` Bharata B Rao
2015-09-14  8:22   ` Alexey Kardashevskiy [this message]
2015-09-14 11:45     ` David Gibson
2015-09-14 12:11       ` Paolo Bonzini
2015-09-14 14:06         ` Alexey Kardashevskiy
2015-09-14 14:24           ` Paolo Bonzini
2015-09-16  3:16             ` David Gibson
2015-09-17 15:50               ` Michael Roth
2015-09-17 15:53                 ` Paolo Bonzini
2015-09-17 23:03                   ` Michael Roth
2015-09-17 15:01             ` Michael Roth
2015-09-15  0:31           ` David Gibson
2015-09-15  0:30         ` David Gibson
2015-09-15 11:05           ` Paolo Bonzini
2015-09-14  1:41 ` [Qemu-devel] [RFCv2 2/2] spapr: Don't use QOM [*] syntax for DR connectors David Gibson
2015-09-14  4:07   ` Bharata B Rao
2015-09-14  4:14     ` David Gibson
2015-09-14  4:41       ` Bharata B Rao
2015-09-14  5:20         ` David Gibson
2015-09-14  8:13   ` Alexey Kardashevskiy
2015-09-15  4:03   ` Michael Roth
2015-09-15  4:21     ` Michael Roth
2015-09-16  3:18     ` David Gibson

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=55F683CB.6000508@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).