From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2hKH-0007Lv-SH for qemu-devel@nongnu.org; Fri, 26 Jul 2013 08:40:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2hKG-0002nv-Cn for qemu-devel@nongnu.org; Fri, 26 Jul 2013 08:40:53 -0400 Received: from cantor2.suse.de ([195.135.220.15]:56217 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2hKG-0002nr-41 for qemu-devel@nongnu.org; Fri, 26 Jul 2013 08:40:52 -0400 Message-ID: <51F26E4F.2040002@suse.de> Date: Fri, 26 Jul 2013 14:40:47 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1374707812-21404-1-git-send-email-afaerber@suse.de> <1374707812-21404-8-git-send-email-afaerber@suse.de> <20130726025800.GD10249@localhost.localdomain> In-Reply-To: <20130726025800.GD10249@localhost.localdomain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH qom-next for-1.6 7/8] pl110: QOM'ify pl110, pl110_versatile and pl111 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hu Tao Cc: qemu-devel@nongnu.org Am 26.07.2013 04:58, schrieb Hu Tao: > On Thu, Jul 25, 2013 at 01:16:51AM +0200, Andreas F=C3=A4rber wrote: >> Let pl110_versatile and pl111 inherit from pl110 and use PL110() cast; >> set their version index in an instance_init. >> >> Signed-off-by: Andreas F=C3=A4rber >> --- >> hw/display/pl110.c | 71 ++++++++++++++++++++++-----------------------= --------- >> 1 file changed, 29 insertions(+), 42 deletions(-) >> > =20 > <...> >=20 >> -static int pl110_init(SysBusDevice *dev) >> +static int pl110_init(SysBusDevice *sbd) >> { >> - PL110State *s =3D FROM_SYSBUS(PL110State, dev); >> + DeviceState *dev =3D DEVICE(sbd); >> + PL110State *s =3D PL110(dev); >> =20 >> memory_region_init_io(&s->iomem, OBJECT(s), &pl110_ops, s, "pl110= ", 0x1000); >> - sysbus_init_mmio(dev, &s->iomem); >> - sysbus_init_irq(dev, &s->irq); >> - qdev_init_gpio_in(&s->busdev.qdev, pl110_mux_ctrl_set, 1); >> - s->con =3D graphic_console_init(DEVICE(dev), &pl110_gfx_ops, s); >> + sysbus_init_mmio(sbd, &s->iomem); >> + sysbus_init_irq(sbd, &s->irq); >> + qdev_init_gpio_in(dev, pl110_mux_ctrl_set, 1); >> + s->con =3D graphic_console_init(dev, &pl110_gfx_ops, s); >> return 0; >=20 > Would it be better to explicitly set PL110 version? I know PL110 is 0, > but it's not like a normal variable which is always good to be > initialized to 0, assuming a version number is bad. (This is not a prob= lem > of this patch) Sure, I can add such a no-op line. Thanks for your watchful review! However I'd like to point out that these series are tailored for 1.6, so I tried to go with a "safe" set of changes (e.g., leaving out most QOM realize conversions). I think a post-1.6 cleanup would be to move such static instance fields into a new PL110Class, set in different ..._class_init rather than ..._init functions. 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