[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/26] ahci: QOM'ify some more
From: |
Hu Tao |
Subject: |
[Qemu-devel] [PATCH 14/26] ahci: QOM'ify some more |
Date: |
Sat, 22 Jun 2013 16:50:26 +0800 |
Introduce type constant and avoid DO_UPCAST().
Cc: Kevin Wolf <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Jason Baron <address@hidden>
Cc: Anthony Liguori <address@hidden>
Cc: "Andreas Färber" <address@hidden>
Signed-off-by: Hu Tao <address@hidden>
---
hw/ide/ahci.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index c2e4b8c..d37c094 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1274,6 +1274,9 @@ const VMStateDescription vmstate_ahci = {
},
};
+#define TYPE_SYSBUS_AHCI "sysbus-ahci"
+#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
+
typedef struct SysbusAHCIState {
SysBusDevice busdev;
AHCIState ahci;
@@ -1281,7 +1284,7 @@ typedef struct SysbusAHCIState {
} SysbusAHCIState;
static const VMStateDescription vmstate_sysbus_ahci = {
- .name = "sysbus-ahci",
+ .name = TYPE_SYSBUS_AHCI,
.unmigratable = 1, /* Still buggy under I/O load */
.fields = (VMStateField []) {
VMSTATE_AHCI(ahci, AHCIPCIState),
@@ -1291,14 +1294,14 @@ static const VMStateDescription vmstate_sysbus_ahci = {
static void sysbus_ahci_reset(DeviceState *dev)
{
- SysbusAHCIState *s = DO_UPCAST(SysbusAHCIState, busdev.qdev, dev);
+ SysbusAHCIState *s = SYSBUS_AHCI(dev);
ahci_reset(&s->ahci);
}
static void sysbus_ahci_realize(DeviceState *dev, Error **errp)
{
- SysbusAHCIState *s = DO_UPCAST(SysbusAHCIState, busdev.qdev, dev);
+ SysbusAHCIState *s = SYSBUS_AHCI(dev);
ahci_init(&s->ahci, dev, NULL, s->num_ports);
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->ahci.mem);
@@ -1321,7 +1324,7 @@ static void sysbus_ahci_class_init(ObjectClass *klass,
void *data)
}
static const TypeInfo sysbus_ahci_info = {
- .name = "sysbus-ahci",
+ .name = TYPE_SYSBUS_AHCI,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SysbusAHCIState),
.class_init = sysbus_ahci_class_init,
--
1.8.3.1
- [Qemu-devel] [PATCH 03/26] i440fx-pcihost: use realize for i440fx-pcihost, (continued)
- [Qemu-devel] [PATCH 03/26] i440fx-pcihost: use realize for i440fx-pcihost, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 02/26] ohci: QOM'ify some more, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 04/26] i440fx: use type-safe cast instead of directly access of parent dev, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 09/26] pflash_cfi01: use realize for pflash_cfi01, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 07/26] fdc: use realize for fdc., Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 05/26] q35: use realize for q35 host, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 10/26] pflash-cfi01: QOM'ify some more, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 12/26] pflash-cfi02: QOM'ify some more, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 11/26] pflash_cfi02: use realize for pflash_cfi02, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 08/26] fdc: QOM'ify some more, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 14/26] ahci: QOM'ify some more,
Hu Tao <=
- [Qemu-devel] [PATCH 06/26] q35: use type-safe cast instead of directly access of parent dev, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 15/26] fwcfg: use realize for fwcfg, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 16/26] fwcfg: QOM'ify some more, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 17/26] scsi esp: use realize for scsi esp, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 13/26] ahci: use realize for ahci, Hu Tao, 2013/06/22
- [Qemu-devel] [PATCH 21/26] kvmclock: use realize for kvmclock, Hu Tao, 2013/06/22