qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [RFCv2 1/2] spapr: Remove unnecessary owner field from sP


From: David Gibson
Subject: Re: [Qemu-ppc] [RFCv2 1/2] spapr: Remove unnecessary owner field from sPAPRDRConnector
Date: Mon, 14 Sep 2015 21:45:03 +1000
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Sep 14, 2015 at 06:22:35PM +1000, Alexey Kardashevskiy wrote:
> 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 <address@hidden>
> >---
> >  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.

Ah, good point, I missed that.  I guess we have to keep the owner
field, redundant though it seems.  Blech.

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: pgpawTu7az06_.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]