diff options
author | Andreas Färber <afaerber@suse.de> | 2013-06-06 15:41:10 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2013-06-24 08:23:10 +0200 |
commit | d4614cc3121b3c6375a63d01947779e36149c68c (patch) | |
tree | a6fc1a146e46f9fcb32230649be931ccae159941 /hw/usb/hcd-ehci-sysbus.c | |
parent | 08f4c90b2887a4499a2f199cf9410308f8ed298c (diff) |
usb/hcd-ehci: Split off instance_init from realize
This makes the mem MemoryRegion available to derived instance_inits.
Keep the bus in realize for now since naming breaks in instance_init.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-ehci-sysbus.c')
-rw-r--r-- | hw/usb/hcd-ehci-sysbus.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 3179e6fe55..e450137c20 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -36,15 +36,24 @@ static void usb_ehci_sysbus_realize(DeviceState *dev, Error **errp) { SysBusDevice *d = SYS_BUS_DEVICE(dev); EHCISysBusState *i = SYS_BUS_EHCI(dev); - SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev); + EHCIState *s = &i->ehci; + + usb_ehci_realize(s, dev, errp); + sysbus_init_irq(d, &s->irq); +} + +static void ehci_sysbus_init(Object *obj) +{ + SysBusDevice *d = SYS_BUS_DEVICE(obj); + EHCISysBusState *i = SYS_BUS_EHCI(obj); + SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(obj); EHCIState *s = &i->ehci; s->capsbase = sec->capsbase; s->opregbase = sec->opregbase; s->as = &address_space_memory; - usb_ehci_realize(s, dev, errp); - sysbus_init_irq(d, &s->irq); + usb_ehci_init(s, DEVICE(obj)); sysbus_init_mmio(d, &s->mem); } @@ -61,6 +70,7 @@ static const TypeInfo ehci_type_info = { .name = TYPE_SYS_BUS_EHCI, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(EHCISysBusState), + .instance_init = ehci_sysbus_init, .abstract = true, .class_init = ehci_sysbus_class_init, .class_size = sizeof(SysBusEHCIClass), |