Am 24.06.2013 08:52, 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/net/pcnet-pci.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c > index 9df2b87..b1afbf4 100644 > --- a/hw/net/pcnet-pci.c > +++ b/hw/net/pcnet-pci.c > @@ -43,6 +43,10 @@ > //#define PCNET_DEBUG_TMD > //#define PCNET_DEBUG_MATCH > > +#define TYPE_PCI_PC_NET "pcnet"
I'm wondering whether we should rename this PCNET rather than PC_NET, but I'm queuing it as is. Thanks, Andreas > + > +#define PCI_PC_NET(obj) \ > + OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PC_NET) > > typedef struct { > PCIDevice pci_dev; > @@ -273,7 +277,7 @@ static void pci_pcnet_cleanup(NetClientState *nc) > > static void pci_pcnet_uninit(PCIDevice *dev) > { > - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, dev); > + PCIPCNetState *d = PCI_PC_NET(dev); > > memory_region_destroy(&d->state.mmio); > memory_region_destroy(&d->io_bar); > @@ -293,7 +297,7 @@ static NetClientInfo net_pci_pcnet_info = { > > static int pci_pcnet_init(PCIDevice *pci_dev) > { > - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev, pci_dev); > + PCIPCNetState *d = PCI_PC_NET(pci_dev); > PCNetState *s = &d->state; > uint8_t *pci_conf; > > @@ -329,12 +333,12 @@ static int pci_pcnet_init(PCIDevice *pci_dev) > s->phys_mem_write = pci_physical_memory_write; > s->dma_opaque = pci_dev; > > - return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info); > + return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info); > } > > static void pci_reset(DeviceState *dev) > { > - PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev); > + PCIPCNetState *d = PCI_PC_NET(dev); > > pcnet_h_reset(&d->state); > } > @@ -362,7 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, void > *data) > } > > static const TypeInfo pcnet_info = { > - .name = "pcnet", > + .name = TYPE_PCI_PC_NET, > .parent = TYPE_PCI_DEVICE, > .instance_size = sizeof(PCIPCNetState), > .class_init = pcnet_class_init, > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg