From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtHTC-00045r-MO for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:15:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtHTB-0000pl-4Z for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:15:10 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49792 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtHTA-0000pK-RJ for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:15:09 -0400 Message-ID: <51D02F58.8020804@suse.de> Date: Sun, 30 Jun 2013 15:15:04 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <754a2c1bb8f9b99e5e8866950feced91b2334fe9.1372055322.git.peter.crosthwaite@xilinx.com> <51CFF7C8.9050906@suse.de> In-Reply-To: <51CFF7C8.9050906@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 13/30] misc/ivshmem: QOM Upcast Sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com Cc: pbonzini@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, Hu Tao Am 30.06.2013 11:18, schrieb Andreas F=E4rber: > Am 24.06.2013 08:59, schrieb peter.crosthwaite@xilinx.com: >> From: Peter Crosthwaite >> >> Define and use standard QOM cast macro. Remove usages of DO_UPCAST >> and direct -> style upcasting. >> >> Signed-off-by: Peter Crosthwaite >> --- >> >> hw/misc/ivshmem.c | 18 +++++++++++------- >> 1 file changed, 11 insertions(+), 7 deletions(-) >> >> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c >> index 5658f73..fd40caf 100644 >> --- a/hw/misc/ivshmem.c >> +++ b/hw/misc/ivshmem.c >> @@ -48,6 +48,10 @@ >> #define IVSHMEM_DPRINTF(fmt, ...) >> #endif >> =20 >> +#define TYPE_IVSHMEM "ivshmem" >> +#define IVSHMEM(obj) \ >> + OBJECT_CHECK(IVShmemState, (obj), TYPE_IVSHMEM) >> + >> typedef struct Peer { >> int nb_eventfds; >> EventNotifier *eventfds; >> @@ -341,7 +345,7 @@ static void create_shared_memory_BAR(IVShmemState = *s, int fd) { >> =20 >> memory_region_init_ram_ptr(&s->ivshmem, "ivshmem.bar2", >> s->ivshmem_size, ptr); >> - vmstate_register_ram(&s->ivshmem, &s->dev.qdev); >> + vmstate_register_ram(&s->ivshmem, DEVICE(&s->dev)); >=20 > DEVICE(s) >=20 >> memory_region_add_subregion(&s->bar, 0, &s->ivshmem); >> =20 >> /* region for shared memory */ >> @@ -469,7 +473,7 @@ static void ivshmem_read(void *opaque, const uint8= _t * buf, int flags) >> incoming_= fd, 0); >> memory_region_init_ram_ptr(&s->ivshmem, >> "ivshmem.bar2", s->ivshmem_size, m= ap_ptr); >> - vmstate_register_ram(&s->ivshmem, &s->dev.qdev); >> + vmstate_register_ram(&s->ivshmem, DEVICE(&s->dev)); >=20 > DEVICE(s) >=20 > Renaming the parent field showed that there are still some s->dev > accesses missed in this patch. Applying anyway to qom-next: > https://github.com/afaerber/qemu-cpu/commits/qom-next Missed two DO_UPCAST()s, fixed up. Andreas diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index dcf1402..1f5f059 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -643,7 +643,7 @@ static void ivshmem_write_config(PCIDevice *pci_dev, uint32_t address, static int pci_ivshmem_init(PCIDevice *dev) { - IVShmemState *s =3D DO_UPCAST(IVShmemState, dev, dev); + IVShmemState *s =3D IVSHMEM(dev); uint8_t *pci_conf; if (s->sizearg =3D=3D NULL) @@ -775,7 +775,7 @@ static int pci_ivshmem_init(PCIDevice *dev) static void pci_ivshmem_uninit(PCIDevice *dev) { - IVShmemState *s =3D DO_UPCAST(IVShmemState, dev, dev); + IVShmemState *s =3D IVSHMEM(dev); if (s->migration_blocker) { migrate_del_blocker(s->migration_blocker); --=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