From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnTF7-0003M7-QT for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:09:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnTEx-0000Rn-Aj for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:08:53 -0500 Received: from cantor2.suse.de ([195.135.220.15]:42518 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnTEx-0000Rj-4W for qemu-devel@nongnu.org; Mon, 02 Dec 2013 08:08:43 -0500 Message-ID: <529C8656.4040406@suse.de> Date: Mon, 02 Dec 2013 14:08:38 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH arm-devs v4 4/4] cpu/a9mpcore: Add Global Timer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Anthony Liguori , Paolo Bonzini Hi, A general observation... Am 02.12.2013 08:37, schrieb Peter Crosthwaite: > diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c > index a38464b..c09358c 100644 > --- a/hw/cpu/a9mpcore.c > +++ b/hw/cpu/a9mpcore.c > @@ -30,6 +30,9 @@ static void a9mp_priv_initfn(Object *obj) > object_initialize(&s->gic, sizeof(s->gic), TYPE_ARM_GIC); > qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default()); > =20 > + object_initialize(&s->gtimer, sizeof(s->gtimer), TYPE_A9_GTIMER); > + qdev_set_parent_bus(DEVICE(&s->gtimer), sysbus_get_default()); > + > object_initialize(&s->mptimer, sizeof(s->mptimer), TYPE_ARM_MPTIME= R); > qdev_set_parent_bus(DEVICE(&s->mptimer), sysbus_get_default()); > =20 This code resulted from inlining qdev_create() and switching to in-place instantiation. Seeing this repetitive code again and again makes me wonder whether we can just set a SysBusDevice's parent_bus in its instance_init function to simplify it? The only downsides I can think of is that SysBus can't instantiate SysBusDevices in its instance_init then to avoid a circular dependency and that the global SysBus might get a few refs more if set both in instance_init and via qdev_set_parent_bus(), but we're not expecting it to be destroyed anyway. CC'ing Paolo. Outside the scope of this patch, obviously. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg