From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCsl-00021Y-B2 for qemu-devel@nongnu.org; Sun, 30 Jun 2013 04:21:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtCsj-0001se-Fq for qemu-devel@nongnu.org; Sun, 30 Jun 2013 04:21:15 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43962 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtCsj-0001sC-7N for qemu-devel@nongnu.org; Sun, 30 Jun 2013 04:21:13 -0400 Message-ID: <51CFEA74.4020600@suse.de> Date: Sun, 30 Jun 2013 10:21:08 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 08/30] ide/ich: QOM Upcast Sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.crosthwaite@xilinx.com, Alexander Graf Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, "Michael S. Tsirkin" Am 24.06.2013 08:55, 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/ide/ahci.h | 5 +++++ > hw/ide/ich.c | 10 +++++----- > 2 files changed, 10 insertions(+), 5 deletions(-) >=20 > diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h > index 341a571..916bef0 100644 > --- a/hw/ide/ahci.h > +++ b/hw/ide/ahci.h > @@ -305,6 +305,11 @@ typedef struct AHCIPCIState { > AHCIState ahci; > } AHCIPCIState; > =20 > +#define TYPE_ICH_AHCI "ich9-ahci" Let's be as precise as for the LSI SCSI HBA and name this ICH9. :) > + > +#define ICH_AHCI(obj) \ > + OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH_AHCI) Wondering if this is specific to ICH(9)? Alex? Leaving it as is for now, renaming is an easy follow-up. > + > extern const VMStateDescription vmstate_ahci; > =20 > #define VMSTATE_AHCI(_field, _state) { \ > diff --git a/hw/ide/ich.c b/hw/ide/ich.c > index 6c0c0c2..c3cbf2a 100644 > --- a/hw/ide/ich.c > +++ b/hw/ide/ich.c > @@ -92,7 +92,7 @@ static const VMStateDescription vmstate_ich9_ahci =3D= { > =20 > static void pci_ich9_reset(DeviceState *dev) > { > - struct AHCIPCIState *d =3D DO_UPCAST(struct AHCIPCIState, card.qde= v, dev); > + struct AHCIPCIState *d =3D ICH_AHCI(dev); Let's drop the "struct" while touching the line. Thanks, applied to qom-next: https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas > =20 > ahci_reset(&d->ahci); > } > @@ -102,9 +102,9 @@ static int pci_ich9_ahci_init(PCIDevice *dev) > struct AHCIPCIState *d; > int sata_cap_offset; > uint8_t *sata_cap; > - d =3D DO_UPCAST(struct AHCIPCIState, card, dev); > + d =3D ICH_AHCI(dev); > =20 > - ahci_init(&d->ahci, &dev->qdev, pci_get_address_space(dev), 6); > + ahci_init(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6); > =20 > pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_= REV_1); > =20 > @@ -141,7 +141,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev) > static void pci_ich9_uninit(PCIDevice *dev) > { > struct AHCIPCIState *d; > - d =3D DO_UPCAST(struct AHCIPCIState, card, dev); > + d =3D ICH_AHCI(dev); > =20 > msi_uninit(dev); > ahci_uninit(&d->ahci); > @@ -163,7 +163,7 @@ static void ich_ahci_class_init(ObjectClass *klass,= void *data) > } > =20 > static const TypeInfo ich_ahci_info =3D { > - .name =3D "ich9-ahci", > + .name =3D TYPE_ICH_AHCI, > .parent =3D TYPE_PCI_DEVICE, > .instance_size =3D sizeof(AHCIPCIState), > .class_init =3D ich_ahci_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