Patchwork [26/26] ehci: use realize for ehci

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

Comments

Hu Tao - June 22, 2013, 8:50 a.m.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/usb/hcd-ehci-sysbus.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
Andreas Färber - June 22, 2013, 10:38 a.m.
Am 22.06.2013 10:50, schrieb Hu Tao:
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  hw/usb/hcd-ehci-sysbus.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)

I had already done this iirc, it should be in Gerd's USB queue, which I
was waiting for to be merged to continue my Tegra work.

Andreas
Andreas Färber - June 30, 2013, 2:41 p.m.
Am 22.06.2013 12:38, schrieb Andreas Färber:
> Am 22.06.2013 10:50, schrieb Hu Tao:
>> Cc: Gerd Hoffmann <kraxel@redhat.com>
>> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
>> ---
>>  hw/usb/hcd-ehci-sysbus.c | 11 +++++------
>>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> I had already done this iirc, it should be in Gerd's USB queue, [...]

FTR it was merged earlier this week:
http://git.qemu.org/?p=qemu.git;a=commit;h=89f204d2c60fbf3e0c5af1ff1681e57c9f057178

Thanks,
Andreas

Patch

diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index b68a66a..8cb594d 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -32,9 +32,10 @@  static Property ehci_sysbus_properties[] = {
     DEFINE_PROP_END_OF_LIST(),
 };
 
-static int usb_ehci_sysbus_initfn(SysBusDevice *dev)
+static void usb_ehci_sysbus_realize(DeviceState *dev, Error **errp)
 {
     EHCISysBusState *i = SYS_BUS_EHCI(dev);
+    SysBusDevice *bus = SYS_BUS_DEVICE(dev);
     SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev);
     EHCIState *s = &i->ehci;
 
@@ -43,17 +44,15 @@  static int usb_ehci_sysbus_initfn(SysBusDevice *dev)
     s->dma = &dma_context_memory;
 
     usb_ehci_initfn(s, DEVICE(dev));
-    sysbus_init_irq(dev, &s->irq);
-    sysbus_init_mmio(dev, &s->mem);
-    return 0;
+    sysbus_init_irq(bus, &s->irq);
+    sysbus_init_mmio(bus, &s->mem);
 }
 
 static void ehci_sysbus_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = usb_ehci_sysbus_initfn;
+    dc->realize = usb_ehci_sysbus_realize;
     dc->vmsd = &vmstate_ehci_sysbus;
     dc->props = ehci_sysbus_properties;
 }