Am 30.06.2013 11:18, schrieb Andreas Färber: > Am 24.06.2013 08:59, schrieb peter.crosthwa...@xilinx.com: >> From: Peter Crosthwaite <peter.crosthwa...@xilinx.com> >> >> Define and use standard QOM cast macro. Remove usages of DO_UPCAST >> and direct -> style upcasting. >> >> Signed-off-by: Peter Crosthwaite <peter.crosthwa...@xilinx.com> >> --- >> >> 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 >> >> +#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) { >> >> 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)); > > DEVICE(s) > >> memory_region_add_subregion(&s->bar, 0, &s->ivshmem); >> >> /* 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, >> map_ptr); >> - vmstate_register_ram(&s->ivshmem, &s->dev.qdev); >> + vmstate_register_ram(&s->ivshmem, DEVICE(&s->dev)); > > DEVICE(s) > > 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 = DO_UPCAST(IVShmemState, dev, dev); + IVShmemState *s = IVSHMEM(dev); uint8_t *pci_conf; if (s->sizearg == NULL) @@ -775,7 +775,7 @@ static int pci_ivshmem_init(PCIDevice *dev) static void pci_ivshmem_uninit(PCIDevice *dev) { - IVShmemState *s = DO_UPCAST(IVShmemState, dev, dev); + IVShmemState *s = IVSHMEM(dev); if (s->migration_blocker) { migrate_del_blocker(s->migration_blocker); -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg