From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1KHG-0001iD-0W for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:52:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1KDY-0000ee-KY for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:48:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35337 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Jjq-000608-SI for qemu-devel@nongnu.org; Mon, 22 Jul 2013 13:17:35 -0400 Message-ID: <51ED692A.7030707@suse.de> Date: Mon, 22 Jul 2013 19:17:30 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <9c7472accbd24d1720a257a63109897a96dfed55.1372055322.git.peter.crosthwaite@xilinx.com> <51CFDF72.2060000@suse.de> In-Reply-To: <51CFDF72.2060000@suse.de> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 03/30] net/pcnet-pci: QOM Upcast Sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, mst@redhat.com Am 30.06.2013 09:34, schrieb Andreas F=E4rber: > Am 24.06.2013 08:52, 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/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 >> =20 >> +#define TYPE_PCI_PC_NET "pcnet" >=20 > I'm wondering whether we should rename this PCNET rather than PC_NET, > but I'm queuing it as is. Thanks, In light of the MP_TIMER vs. MPTIMER discussion elsewhere I'm changing both patches, i.e. TYPE_PCI_PCNET and PCI_PCNET() here, in line with pcnet_ prefix. Andreas >> + >> +#define PCI_PC_NET(obj) \ >> + OBJECT_CHECK(PCIPCNetState, (obj), TYPE_PCI_PC_NET) >> =20 >> typedef struct { >> PCIDevice pci_dev; >> @@ -273,7 +277,7 @@ static void pci_pcnet_cleanup(NetClientState *nc) >> =20 >> static void pci_pcnet_uninit(PCIDevice *dev) >> { >> - PCIPCNetState *d =3D DO_UPCAST(PCIPCNetState, pci_dev, dev); >> + PCIPCNetState *d =3D PCI_PC_NET(dev); >> =20 >> memory_region_destroy(&d->state.mmio); >> memory_region_destroy(&d->io_bar); >> @@ -293,7 +297,7 @@ static NetClientInfo net_pci_pcnet_info =3D { >> =20 >> static int pci_pcnet_init(PCIDevice *pci_dev) >> { >> - PCIPCNetState *d =3D DO_UPCAST(PCIPCNetState, pci_dev, pci_dev); >> + PCIPCNetState *d =3D PCI_PC_NET(pci_dev); >> PCNetState *s =3D &d->state; >> uint8_t *pci_conf; >> =20 >> @@ -329,12 +333,12 @@ static int pci_pcnet_init(PCIDevice *pci_dev) >> s->phys_mem_write =3D pci_physical_memory_write; >> s->dma_opaque =3D pci_dev; >> =20 >> - return pcnet_common_init(&pci_dev->qdev, s, &net_pci_pcnet_info); >> + return pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info)= ; >> } >> =20 >> static void pci_reset(DeviceState *dev) >> { >> - PCIPCNetState *d =3D DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev); >> + PCIPCNetState *d =3D PCI_PC_NET(dev); >> =20 >> pcnet_h_reset(&d->state); >> } >> @@ -362,7 +366,7 @@ static void pcnet_class_init(ObjectClass *klass, v= oid *data) >> } >> =20 >> static const TypeInfo pcnet_info =3D { >> - .name =3D "pcnet", >> + .name =3D TYPE_PCI_PC_NET, >> .parent =3D TYPE_PCI_DEVICE, >> .instance_size =3D sizeof(PCIPCNetState), >> .class_init =3D pcnet_class_init, >> >=20 >=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