From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Pok-0002wr-As for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:47:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Pog-0003v0-3p for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:47:02 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45801 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Pof-0003ud-Nz for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:46:57 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 01:46:06 +0200 Message-Id: <1374536796-13983-26-git-send-email-afaerber@suse.de> In-Reply-To: <1374536796-13983-1-git-send-email-afaerber@suse.de> References: <1374536796-13983-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 25/55] xen/xen_platform: QOM casting sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Peter Crosthwaite Define and use standard QOM cast macro. Remove usages of DO_UPCAST() and direct -> style upcasting. Signed-off-by: Peter Crosthwaite [AF: Dropped opaque casts] Signed-off-by: Andreas F=C3=A4rber --- hw/xen/xen_platform.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c index 15d7cf0..52a7279 100644 --- a/hw/xen/xen_platform.c +++ b/hw/xen/xen_platform.c @@ -62,6 +62,10 @@ typedef struct PCIXenPlatformState { int log_buffer_off; } PCIXenPlatformState; =20 +#define TYPE_XEN_PLATFORM "xen-platform" +#define XEN_PLATFORM(obj) \ + OBJECT_CHECK(PCIXenPlatformState, (obj), TYPE_XEN_PLATFORM) + #define XEN_PLATFORM_IOPORT 0x10 =20 /* Send bytes to syslog */ @@ -88,7 +92,7 @@ static void unplug_nic(PCIBus *b, PCIDevice *d, void *o= ) if (pci_get_word(d->config + PCI_CLASS_DEVICE) =3D=3D PCI_CLASS_NETWORK_ETHERNET && strcmp(d->name, "xen-pci-passthrough") !=3D 0) { - qdev_free(&d->qdev); + qdev_free(DEVICE(d)); } } =20 @@ -103,7 +107,7 @@ static void unplug_disks(PCIBus *b, PCIDevice *d, voi= d *o) if (pci_get_word(d->config + PCI_CLASS_DEVICE) =3D=3D PCI_CLASS_STORAGE_IDE && strcmp(d->name, "xen-pci-passthrough") !=3D 0) { - qdev_unplug(&(d->qdev), NULL); + qdev_unplug(DEVICE(d), NULL); } } =20 @@ -376,7 +380,7 @@ static const VMStateDescription vmstate_xen_platform = =3D { =20 static int xen_platform_initfn(PCIDevice *dev) { - PCIXenPlatformState *d =3D DO_UPCAST(PCIXenPlatformState, pci_dev, d= ev); + PCIXenPlatformState *d =3D XEN_PLATFORM(dev); uint8_t *pci_conf; =20 pci_conf =3D d->pci_dev.config; @@ -402,7 +406,7 @@ static int xen_platform_initfn(PCIDevice *dev) =20 static void platform_reset(DeviceState *dev) { - PCIXenPlatformState *s =3D DO_UPCAST(PCIXenPlatformState, pci_dev.qd= ev, dev); + PCIXenPlatformState *s =3D XEN_PLATFORM(dev); =20 platform_fixed_ioport_reset(s); } @@ -425,7 +429,7 @@ static void xen_platform_class_init(ObjectClass *klas= s, void *data) } =20 static const TypeInfo xen_platform_info =3D { - .name =3D "xen-platform", + .name =3D TYPE_XEN_PLATFORM, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(PCIXenPlatformState), .class_init =3D xen_platform_class_init, --=20 1.8.1.4