From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SZh-0008Fk-Mk for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:43:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1SZf-0000tc-PZ for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:43:41 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49488 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1SZf-0000tK-Ib for qemu-devel@nongnu.org; Mon, 22 Jul 2013 22:43:39 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 04:43:20 +0200 Message-Id: <1374547404-11700-13-git-send-email-afaerber@suse.de> In-Reply-To: <1374547404-11700-1-git-send-email-afaerber@suse.de> References: <1374547404-11700-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v2 12/16] cpu/a15mpcore: QOM cast cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Paul Brook From: Andreas F=C3=A4rber Introduce type constant and cast macro and rename A15MPPrivState::busdev field to parent_obj to enforce its use. Prepares for QOM realize. Signed-off-by: Andreas F=C3=A4rber --- hw/cpu/a15mpcore.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index c736257..4f37964 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -23,8 +23,15 @@ =20 /* A15MP private memory region. */ =20 +#define TYPE_A15MPCORE_PRIV "a15mpcore_priv" +#define A15MPCORE_PRIV(obj) \ + OBJECT_CHECK(A15MPPrivState, (obj), TYPE_A15MPCORE_PRIV) + typedef struct A15MPPrivState { - SysBusDevice busdev; + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + uint32_t num_cpu; uint32_t num_irq; MemoryRegion container; @@ -39,7 +46,7 @@ static void a15mp_priv_set_irq(void *opaque, int irq, i= nt level) =20 static int a15mp_priv_init(SysBusDevice *dev) { - A15MPPrivState *s =3D FROM_SYSBUS(A15MPPrivState, dev); + A15MPPrivState *s =3D A15MPCORE_PRIV(dev); SysBusDevice *busdev; const char *gictype =3D "arm_gic"; =20 @@ -58,7 +65,7 @@ static int a15mp_priv_init(SysBusDevice *dev) sysbus_pass_irq(dev, busdev); =20 /* Pass through inbound GPIO lines to the GIC */ - qdev_init_gpio_in(&s->busdev.qdev, a15mp_priv_set_irq, s->num_irq - = 32); + qdev_init_gpio_in(DEVICE(dev), a15mp_priv_set_irq, s->num_irq - 32); =20 /* Memory map (addresses are offsets from PERIPHBASE): * 0x0000-0x0fff -- reserved @@ -101,7 +108,7 @@ static void a15mp_priv_class_init(ObjectClass *klass,= void *data) } =20 static const TypeInfo a15mp_priv_info =3D { - .name =3D "a15mpcore_priv", + .name =3D TYPE_A15MPCORE_PRIV, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(A15MPPrivState), .class_init =3D a15mp_priv_class_init, --=20 1.8.1.4