Received: from eggs.gnu.org ([2001:4830:134:3::10]:58409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Poe-0002kH-S4 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:47:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Poa-0003rN-Tx for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:46:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45778 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Poa-0003r2-J6 for qemu-devel@nongnu.org; Mon, 22 Jul 2013 19:46:52 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 23 Jul 2013 01:45:56 +0200 Message-Id: <1374536796-13983-16-git-send-email-afaerber@suse.de> In-Reply-To: <1374536796-13983-1-git-send-email-afaerber@suse.de> References: <1374536796-13983-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 15/55] ide/ich: QOM Upcast Sweep List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Peter Crosthwaite Define and use standard QOM cast macro. Remove usages of DO_UPCAST() and direct -> style upcasting. Signed-off-by: Peter Crosthwaite [AF: Renamed to TYPE_ICH9_AHCI and used typedef in pci_ich9_reset()] Signed-off-by: Andreas F=C3=A4rber --- hw/ide/ahci.h | 5 +++++ hw/ide/ich.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h index 341a571..f997c67 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -305,6 +305,11 @@ typedef struct AHCIPCIState { AHCIState ahci; } AHCIPCIState; =20 +#define TYPE_ICH9_AHCI "ich9-ahci" + +#define ICH_AHCI(obj) \ + OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI) + 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..a6f78dc 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.qdev,= dev); + AHCIPCIState *d =3D ICH_AHCI(dev); =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_RE= V_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, v= oid *data) } =20 static const TypeInfo ich_ahci_info =3D { - .name =3D "ich9-ahci", + .name =3D TYPE_ICH9_AHCI, .parent =3D TYPE_PCI_DEVICE, .instance_size =3D sizeof(AHCIPCIState), .class_init =3D ich_ahci_class_init, --=20 1.8.1.4