aboutsummaryrefslogtreecommitdiff
path: root/hw/ide/ahci.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2013-07-01 18:18:30 +0800
committerAndreas Färber <afaerber@suse.de>2013-07-23 00:37:34 +0200
commitb3b162c3cfb88a57390fef581c1be99648d6d8ab (patch)
tree217ce5fadd03592274bdd6d716c491c82e99af2b /hw/ide/ahci.c
parent3509c396d2894b4dc40a2e33d7c2f795508d7328 (diff)
ahci: QOM'ify some more
Introduce type constant and avoid DO_UPCAST(). Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> [AF: Renamed parent field] Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/ide/ahci.c')
-rw-r--r--hw/ide/ahci.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index f295732599..d76e6eb9bf 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1286,8 +1286,14 @@ 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;
+ /*< private >*/
+ SysBusDevice parent_obj;
+ /*< public >*/
+
AHCIState ahci;
uint32_t num_ports;
} SysbusAHCIState;
@@ -1303,15 +1309,15 @@ 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 int sysbus_ahci_init(SysBusDevice *dev)
{
- SysbusAHCIState *s = FROM_SYSBUS(SysbusAHCIState, dev);
- ahci_init(&s->ahci, &dev->qdev, NULL, s->num_ports);
+ SysbusAHCIState *s = SYSBUS_AHCI(dev);
+ ahci_init(&s->ahci, DEVICE(dev), NULL, s->num_ports);
sysbus_init_mmio(dev, &s->ahci.mem);
sysbus_init_irq(dev, &s->ahci.irq);
@@ -1335,7 +1341,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,