From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t08-0002AQ-T9 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:21:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3t03-0002DP-16 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:21:00 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53238 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t02-0002DK-S4 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:20:54 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 29 Jul 2013 21:17:57 +0200 Message-Id: <1375125630-24869-21-git-send-email-afaerber@suse.de> In-Reply-To: <1375125630-24869-1-git-send-email-afaerber@suse.de> References: <1375125630-24869-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] [PULL 020/173] pl041: QOM cast cleanup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Vassili Karpov (malc)" , =?UTF-8?q?Andreas=20F=C3=A4rber?= Introduce a type constant, use QOM casts and rename the parent field. Reviewed-by: Hu Tao Signed-off-by: Andreas F=C3=A4rber --- hw/audio/pl041.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c index c4d4f75..5393b52 100644 --- a/hw/audio/pl041.c +++ b/hw/audio/pl041.c @@ -70,8 +70,12 @@ typedef struct { uint8_t rx_sample_size; } pl041_channel; =20 +#define TYPE_PL041 "pl041" +#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041) + typedef struct PL041State { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; qemu_irq irq; =20 @@ -504,7 +508,7 @@ static void pl041_write(void *opaque, hwaddr offset, =20 static void pl041_device_reset(DeviceState *d) { - PL041State *s =3D DO_UPCAST(PL041State, busdev.qdev, d); + PL041State *s =3D PL041(d); =20 pl041_reset(s); } @@ -517,7 +521,7 @@ static const MemoryRegionOps pl041_ops =3D { =20 static int pl041_init(SysBusDevice *dev) { - PL041State *s =3D FROM_SYSBUS(PL041State, dev); + PL041State *s =3D PL041(dev); =20 DBG_L1("pl041_init 0x%08x\n", (uint32_t)s); =20 @@ -635,7 +639,7 @@ static void pl041_device_class_init(ObjectClass *klas= s, void *data) } =20 static const TypeInfo pl041_device_info =3D { - .name =3D "pl041", + .name =3D TYPE_PL041, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(PL041State), .class_init =3D pl041_device_class_init, --=20 1.8.1.4