From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCJ8-0004Lq-Vv for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:44:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtCJ7-0006Eg-QE for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:44:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43108 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCJ7-0006Eb-Gk for qemu-devel@nongnu.org; Sun, 30 Jun 2013 03:44:25 -0400 Message-ID: <51CFE1D3.7080604@suse.de> Date: Sun, 30 Jun 2013 09:44:19 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <7a74619d53f723e8b6160c85642dd8933c8e99db.1372055322.git.peter.crosthwaite@xilinx.com> In-Reply-To: <7a74619d53f723e8b6160c85642dd8933c8e99db.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 04/30] usb/hcd-xhci: QOM Upcast Sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com Cc: pbonzini@redhat.com, Gerd Hoffmann , 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/usb/hcd-xhci.c | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) >=20 > diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c > index 91633ed..0146711 100644 > --- a/hw/usb/hcd-xhci.c > +++ b/hw/usb/hcd-xhci.c > @@ -482,6 +482,11 @@ struct XHCIState { > XHCIRing cmd_ring; > }; > =20 > +#define TYPE_XHCI "nec-usb-xhci" > + > +#define XHCI(obj) \ > + OBJECT_CHECK(XHCIState, (obj), TYPE_XHCI) > + > typedef struct XHCIEvRingSeg { > uint32_t addr_low; > uint32_t addr_high; > @@ -2681,7 +2686,7 @@ static void xhci_port_reset(XHCIPort *port) > =20 > static void xhci_reset(DeviceState *dev) > { > - XHCIState *xhci =3D DO_UPCAST(XHCIState, pci_dev.qdev, dev); > + XHCIState *xhci =3D XHCI(dev); > int i; > =20 > trace_usb_xhci_reset(); > @@ -2926,6 +2931,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg= , > uint64_t val, unsigned size) > { > XHCIState *xhci =3D ptr; > + DeviceState *d =3D DEVICE(ptr); > =20 > trace_usb_xhci_oper_write(reg, val); > =20 > @@ -2939,7 +2945,7 @@ static void xhci_oper_write(void *ptr, hwaddr reg= , > xhci->usbcmd =3D val & 0xc0f; > xhci_mfwrap_update(xhci); > if (val & USBCMD_HCRST) { > - xhci_reset(&xhci->pci_dev.qdev); > + xhci_reset(d); > } > xhci_intx_update(xhci); > break; > @@ -3267,6 +3273,7 @@ static USBBusOps xhci_bus_ops =3D { > =20 > static void usb_xhci_init(XHCIState *xhci, DeviceState *dev) > { > + DeviceState *d =3D DEVICE(xhci); This is duplicating the dev argument. I'll drop that and rename your variable to dev instead: https://github.com/afaerber/qemu-cpu/commits/qom-next Thanks, Andreas > XHCIPort *port; > int i, usbports, speedmask; > =20 > @@ -3281,7 +3288,7 @@ static void usb_xhci_init(XHCIState *xhci, Device= State *dev) > usbports =3D MAX(xhci->numports_2, xhci->numports_3); > xhci->numports =3D xhci->numports_2 + xhci->numports_3; > =20 > - usb_bus_new(&xhci->bus, &xhci_bus_ops, &xhci->pci_dev.qdev); > + usb_bus_new(&xhci->bus, &xhci_bus_ops, d); > =20 > for (i =3D 0; i < usbports; i++) { > speedmask =3D 0; > @@ -3313,14 +3320,14 @@ static int usb_xhci_initfn(struct PCIDevice *de= v) > { > int i, ret; > =20 > - XHCIState *xhci =3D DO_UPCAST(XHCIState, pci_dev, dev); > + XHCIState *xhci =3D XHCI(dev); > =20 > xhci->pci_dev.config[PCI_CLASS_PROG] =3D 0x30; /* xHCI */ > xhci->pci_dev.config[PCI_INTERRUPT_PIN] =3D 0x01; /* interrupt pin= 1 */ > xhci->pci_dev.config[PCI_CACHE_LINE_SIZE] =3D 0x10; > xhci->pci_dev.config[0x60] =3D 0x30; /* release number */ > =20 > - usb_xhci_init(xhci, &dev->qdev); > + usb_xhci_init(xhci, DEVICE(dev)); > =20 > if (xhci->numintrs > MAXINTRS) { > xhci->numintrs =3D MAXINTRS; > @@ -3581,7 +3588,7 @@ static void xhci_class_init(ObjectClass *klass, v= oid *data) > } > =20 > static const TypeInfo xhci_info =3D { > - .name =3D "nec-usb-xhci", > + .name =3D TYPE_XHCI, > .parent =3D TYPE_PCI_DEVICE, > .instance_size =3D sizeof(XHCIState), > .class_init =3D xhci_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