From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtE2H-0003ef-GO for qemu-devel@nongnu.org; Sun, 30 Jun 2013 05:35:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtDzZ-0001gr-8p for qemu-devel@nongnu.org; Sun, 30 Jun 2013 05:32:23 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45596 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtDzY-0001gl-Ts for qemu-devel@nongnu.org; Sun, 30 Jun 2013 05:32:21 -0400 Message-ID: <51CFFB1F.9030000@suse.de> Date: Sun, 30 Jun 2013 11:32:15 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com> In-Reply-To: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 14/30] xen/xen_platform: QOM casting sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com Cc: pbonzini@redhat.com, Stefano Stabellini , qemu-devel@nongnu.org, mst@redhat.com Am 24.06.2013 09:00, schrieb peter.crosthwaite@xilinx.com: > From: Peter Crosthwaite >=20 > Define and use standard QOM cast macro. Remove usages of DO_UPCAST > and direct -> style upcasting. >=20 > Signed-off-by: Peter Crosthwaite > --- >=20 > hw/xen/xen_platform.c | 28 ++++++++++++++++------------ > 1 file changed, 16 insertions(+), 12 deletions(-) >=20 > diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c > index b6c6793..f119c44 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, v= oid *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 > @@ -114,7 +118,7 @@ static void pci_unplug_disks(PCIBus *bus) > =20 > static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, = uint32_t val) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); These are superfluous since PCIXenPlatformState is passed for both MemoryRegionOps. Dropping these hunks. Some usages of the parent field are still left behind. Thanks, applied to qom-next: https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas > =20 > switch (addr) { > case 0: > @@ -164,7 +168,7 @@ static void platform_fixed_ioport_writel(void *opaq= ue, uint32_t addr, > =20 > static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, = uint32_t val) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > switch (addr) { > case 0: /* Platform flags */ { > @@ -187,7 +191,7 @@ static void platform_fixed_ioport_writeb(void *opaq= ue, uint32_t addr, uint32_t v > =20 > static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t add= r) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > switch (addr) { > case 0: > @@ -206,7 +210,7 @@ static uint32_t platform_fixed_ioport_readw(void *o= paque, uint32_t addr) > =20 > static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t add= r) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > switch (addr) { > case 0: > @@ -222,7 +226,7 @@ static uint32_t platform_fixed_ioport_readb(void *o= paque, uint32_t addr) > =20 > static void platform_fixed_ioport_reset(void *opaque) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > platform_fixed_ioport_writeb(s, 0, 0); > } > @@ -292,7 +296,7 @@ static uint64_t xen_platform_ioport_readb(void *opa= que, hwaddr addr, > static void xen_platform_ioport_writeb(void *opaque, hwaddr addr, > uint64_t val, unsigned int size= ) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > switch (addr) { > case 0: /* Platform flags */ > @@ -349,7 +353,7 @@ static void platform_mmio_setup(PCIXenPlatformState= *d) > =20 > static int xen_platform_post_load(void *opaque, int version_id) > { > - PCIXenPlatformState *s =3D opaque; > + PCIXenPlatformState *s =3D XEN_PLATFORM(opaque); > =20 > platform_fixed_ioport_writeb(s, 0, s->flags); > =20 > @@ -371,7 +375,7 @@ static const VMStateDescription vmstate_xen_platfor= m =3D { > =20 > static int xen_platform_initfn(PCIDevice *dev) > { > - PCIXenPlatformState *d =3D DO_UPCAST(PCIXenPlatformState, pci_dev,= dev); > + PCIXenPlatformState *d =3D XEN_PLATFORM(dev); > uint8_t *pci_conf; > =20 > pci_conf =3D d->pci_dev.config; > @@ -397,7 +401,7 @@ static int xen_platform_initfn(PCIDevice *dev) > =20 > static void platform_reset(DeviceState *dev) > { > - PCIXenPlatformState *s =3D DO_UPCAST(PCIXenPlatformState, pci_dev.= qdev, dev); > + PCIXenPlatformState *s =3D XEN_PLATFORM(dev); > =20 > platform_fixed_ioport_reset(s); > } > @@ -420,7 +424,7 @@ static void xen_platform_class_init(ObjectClass *kl= ass, 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 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg