From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49894) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtC9H-0001Zj-Tn for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:34:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtC9G-0002pT-Ua for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:34:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42930 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtC9G-0002pM-LJ for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:34:14 -0400 Message-ID: <51CFDF72.2060000@suse.de> Date: Sun, 30 Jun 2013 09:34:10 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <9c7472accbd24d1720a257a63109897a96dfed55.1372055322.git.peter.crosthwaite@xilinx.com> In-Reply-To: <9c7472accbd24d1720a257a63109897a96dfed55.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 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 24.06.2013 08:52, 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/net/pcnet-pci.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) >=20 > 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" 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) > =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, vo= id *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 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg