diff options
author | Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 2013-06-24 16:55:45 +1000 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-23 00:37:33 +0200 |
commit | fd58922cf4ea09c8dbd2d46dd61e50e6559bf447 (patch) | |
tree | f728d3861c3f72adabd2dea6a406f5fe46b5ea38 /hw/ide | |
parent | 4e5dcc774a4003e313b6eec823067b3980b0bc91 (diff) | |
download | qemu-fd58922cf4ea09c8dbd2d46dd61e50e6559bf447.tar.gz qemu-fd58922cf4ea09c8dbd2d46dd61e50e6559bf447.tar.bz2 qemu-fd58922cf4ea09c8dbd2d46dd61e50e6559bf447.zip |
ide/ich: QOM Upcast Sweep
Define and use standard QOM cast macro. Remove usages of DO_UPCAST()
and direct -> style upcasting.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
[AF: Renamed to TYPE_ICH9_AHCI and used typedef in pci_ich9_reset()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/ahci.h | 5 | ||||
-rw-r--r-- | 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 341a5711ee..f997c673b2 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -305,6 +305,11 @@ typedef struct AHCIPCIState { AHCIState ahci; } AHCIPCIState; +#define TYPE_ICH9_AHCI "ich9-ahci" + +#define ICH_AHCI(obj) \ + OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI) + extern const VMStateDescription vmstate_ahci; #define VMSTATE_AHCI(_field, _state) { \ diff --git a/hw/ide/ich.c b/hw/ide/ich.c index 6c0c0c2935..a6f78dcadf 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -92,7 +92,7 @@ static const VMStateDescription vmstate_ich9_ahci = { static void pci_ich9_reset(DeviceState *dev) { - struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card.qdev, dev); + AHCIPCIState *d = ICH_AHCI(dev); 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 = DO_UPCAST(struct AHCIPCIState, card, dev); + d = ICH_AHCI(dev); - ahci_init(&d->ahci, &dev->qdev, pci_get_address_space(dev), 6); + ahci_init(&d->ahci, DEVICE(dev), pci_get_address_space(dev), 6); pci_config_set_prog_interface(d->card.config, AHCI_PROGMODE_MAJOR_REV_1); @@ -141,7 +141,7 @@ static int pci_ich9_ahci_init(PCIDevice *dev) static void pci_ich9_uninit(PCIDevice *dev) { struct AHCIPCIState *d; - d = DO_UPCAST(struct AHCIPCIState, card, dev); + d = ICH_AHCI(dev); msi_uninit(dev); ahci_uninit(&d->ahci); @@ -163,7 +163,7 @@ static void ich_ahci_class_init(ObjectClass *klass, void *data) } static const TypeInfo ich_ahci_info = { - .name = "ich9-ahci", + .name = TYPE_ICH9_AHCI, .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(AHCIPCIState), .class_init = ich_ahci_class_init, |