From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXLGR-0003W2-SA for qemu-devel@nongnu.org; Wed, 23 May 2012 19:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXLGQ-0004yA-1c for qemu-devel@nongnu.org; Wed, 23 May 2012 19:46:47 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45008 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXLGP-0004y0-Of for qemu-devel@nongnu.org; Wed, 23 May 2012 19:46:45 -0400 Message-ID: <4FBD76DC.6010604@suse.de> Date: Thu, 24 May 2012 01:46:36 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1335958273-769-1-git-send-email-pbonzini@redhat.com> <1335958273-769-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1335958273-769-11-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 10/21] qdev: do not propagate properties to subclasses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, qemu-devel@nongnu.org Am 02.05.2012 13:31, schrieb Paolo Bonzini: > As soon as we'll look up properties along the inheritance chain, we > will have duplicates if class A defines some properties and its > subclass B does not define any, because class_b->props will be > left equal to class_a->props. >=20 > The solution here is to reintroduce the class_base_init TypeInfo > callback, that was present in one of the early QOM versions but > removed (on my request...) before committing. >=20 > Signed-off-by: Paolo Bonzini This breaks `make check` once again: GTESTER check-qtest-i386 qemu-system-i386: Property '.id' not found Andreas > --- > hw/qdev.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) >=20 > diff --git a/hw/qdev.c b/hw/qdev.c > index 94fb32e..67d7770 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c > @@ -658,6 +658,16 @@ static void device_finalize(Object *obj) > QTAILQ_REMOVE(&dev->parent_bus->children, dev, sibling); > } > =20 > +static void device_class_base_init(ObjectClass *class, void *data) > +{ > + DeviceClass *klass =3D DEVICE_CLASS(class); > + > + /* We explicitly look up properties in the superclasses, > + * so do not propagate them to the subclasses. > + */ > + klass->props =3D NULL; > +} > + > void device_reset(DeviceState *dev) > { > DeviceClass *klass =3D DEVICE_GET_CLASS(dev); > @@ -684,6 +694,7 @@ static TypeInfo device_type_info =3D { > .instance_size =3D sizeof(DeviceState), > .instance_init =3D device_initfn, > .instance_finalize =3D device_finalize, > + .class_base_init =3D device_class_base_init, > .abstract =3D true, > .class_size =3D sizeof(DeviceClass), > }; --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg