Patchwork [13/26] ahci: use realize for ahci

login
register
mail settings
Submitter Hu Tao
Date June 22, 2013, 8:50 a.m.
Message ID <783700c29d36371f4f9742fecfbf9c96e1019d96.1371804804.git.hutao@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/253382/
State New
Headers show

Comments

Hu Tao - June 22, 2013, 8:50 a.m.
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jason Baron <jbaron@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/ide/ahci.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index eab6096..c2e4b8c 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1296,14 +1296,13 @@  static void sysbus_ahci_reset(DeviceState *dev)
     ahci_reset(&s->ahci);
 }
 
-static int sysbus_ahci_init(SysBusDevice *dev)
+static void sysbus_ahci_realize(DeviceState *dev, Error **errp)
 {
-    SysbusAHCIState *s = FROM_SYSBUS(SysbusAHCIState, dev);
-    ahci_init(&s->ahci, &dev->qdev, NULL, s->num_ports);
+    SysbusAHCIState *s = DO_UPCAST(SysbusAHCIState, busdev.qdev, dev);
+    ahci_init(&s->ahci, dev, NULL, s->num_ports);
 
-    sysbus_init_mmio(dev, &s->ahci.mem);
-    sysbus_init_irq(dev, &s->ahci.irq);
-    return 0;
+    sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->ahci.mem);
+    sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->ahci.irq);
 }
 
 static Property sysbus_ahci_properties[] = {
@@ -1313,10 +1312,9 @@  static Property sysbus_ahci_properties[] = {
 
 static void sysbus_ahci_class_init(ObjectClass *klass, void *data)
 {
-    SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
     DeviceClass *dc = DEVICE_CLASS(klass);
 
-    sbc->init = sysbus_ahci_init;
+    dc->realize = sysbus_ahci_realize;
     dc->vmsd = &vmstate_sysbus_ahci;
     dc->props = sysbus_ahci_properties;
     dc->reset = sysbus_ahci_reset;