From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbSBj-0001mY-Si for qemu-devel@nongnu.org; Mon, 14 Sep 2015 07:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZbSBi-00009m-PR for qemu-devel@nongnu.org; Mon, 14 Sep 2015 07:44:47 -0400 Date: Mon, 14 Sep 2015 21:45:03 +1000 From: David Gibson Message-ID: <20150914114503.GP2547@voom.fritz.box> References: <1442194913-26545-1-git-send-email-david@gibson.dropbear.id.au> <1442194913-26545-2-git-send-email-david@gibson.dropbear.id.au> <55F683CB.6000508@ozlabs.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="8G1nIWD3RY794FAy" Content-Disposition: inline In-Reply-To: <55F683CB.6000508@ozlabs.ru> Subject: Re: [Qemu-devel] [RFCv2 1/2] spapr: Remove unnecessary owner field from sPAPRDRConnector List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, agraf@suse.de, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, pbonzini@redhat.com --8G1nIWD3RY794FAy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 > >--- > > 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 =3D 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 *own= er, > > > > drc->type =3D type; > > drc->id =3D id; > >- drc->owner =3D owner; > > object_property_add_child(owner, "dr-connector[*]", OBJECT(drc), N= ULL); >=20 >=20 > The comment for object_property_add_child() in include/qom/object.h says: >=20 > =3D=3D=3D > * There is no way for a child to determine what its parent is. It is not > * a bidirectional relationship. This is by design. > =3D=3D=3D >=20 > 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? >=20 > 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. --=20 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 --8G1nIWD3RY794FAy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV9rM/AAoJEGw4ysog2bOSNA4QAJUAHDf/vOzI94hpmiDtbCFe 6REIItKg3AqdeTI/Aqa0bG7zLxMKJbit4rT2rJrsYZGFfcPUeC28PZtYzz5742Gh y/n1YiaAaoqzcCGw2Umwvvw5W4f0C8BK/Voq18kDUK02XjsegR+Y76FbpvUB7b71 3hKU8A2jracjT18PH9ZLp4qixe+EhoINcakIO45LrRT+V0lVLIDQx4yb/0Ohjoe3 /Iti31bonlAXD2ofEdxJzc/qbozAEbIzbY8cGjMF4DfmbbuTNsq4BluikwzCdLjZ VJt9UuvGvdgaczmkvTtfW1LwAHTDNtlp0EUr0dkQ+FDDtL90ck2q9a+lYvtcR9Ds Ur3v71eLAp1yrm86qvN+s1t4ThZ/mVYFPavnWl+22dtJMEPZCh9NyYQ6Np4VVqFm LkY1giG53hfGOfaBwfvR5kGwDL6Plc5eulNOOeWcVSGTww97pwaE0+No8rh6ZzkV Tg2+Iixszl9J2PvmD30J646rM3Ite5Isv2Q/lWW3cE/XVdD6Gpb0BB0FoEgF3CcV 4n6CNOgEth2aJXKUOAGHhyKy3MOkRr1lZDa28SwZSSMctkmkBE25SVQHSfqqco0J ruaIfNjs/DO+Mq1Z9/gzmr85Asz8omQP/AHwwC7ywHe6UDM07L1zjPNcL2er5vSu vY+DmWwsnZu87+/CWJWU =CS0a -----END PGP SIGNATURE----- --8G1nIWD3RY794FAy--