[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/9] usb/hcd-ehci-sysbus: Convert to QOM realize
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 1/9] usb/hcd-ehci-sysbus: Convert to QOM realize |
Date: |
Mon, 24 Jun 2013 08:44:35 +0200 |
From: Andreas Färber <address@hidden>
The SysBus qdev initfn merely calls SysBusDeviceClass::init, so we can
replace it with a realizefn already. This avoids getting into any initfn
ambiguity with the upcoming Faraday EHCI implementation.
Rename internal usb_ehci_initfn() to usb_ehci_realize() to allow to
return Errors from common initialization code as well.
Signed-off-by: Andreas Färber <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/hcd-ehci-pci.c | 2 +-
hw/usb/hcd-ehci-sysbus.c | 13 ++++++-------
hw/usb/hcd-ehci.c | 2 +-
hw/usb/hcd-ehci.h | 2 +-
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c
index f1b5f5d..b352f73 100644
--- a/hw/usb/hcd-ehci-pci.c
+++ b/hw/usb/hcd-ehci-pci.c
@@ -68,7 +68,7 @@ static int usb_ehci_pci_initfn(PCIDevice *dev)
s->capsbase = 0x00;
s->opregbase = 0x20;
- usb_ehci_initfn(s, DEVICE(dev));
+ usb_ehci_realize(s, DEVICE(dev), NULL);
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mem);
return 0;
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index f9e4fd3..3179e6f 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -32,8 +32,9 @@ 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)
{
+ SysBusDevice *d = SYS_BUS_DEVICE(dev);
EHCISysBusState *i = SYS_BUS_EHCI(dev);
SysBusEHCIClass *sec = SYS_BUS_EHCI_GET_CLASS(dev);
EHCIState *s = &i->ehci;
@@ -42,18 +43,16 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev)
s->opregbase = sec->opregbase;
s->as = &address_space_memory;
- usb_ehci_initfn(s, DEVICE(dev));
- sysbus_init_irq(dev, &s->irq);
- sysbus_init_mmio(dev, &s->mem);
- return 0;
+ usb_ehci_realize(s, dev, errp);
+ sysbus_init_irq(d, &s->irq);
+ sysbus_init_mmio(d, &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;
}
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 1ad2159..ea0379b 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2508,7 +2508,7 @@ const VMStateDescription vmstate_ehci = {
}
};
-void usb_ehci_initfn(EHCIState *s, DeviceState *dev)
+void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
{
int i;
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 2fcb92f..15c7630 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -322,7 +322,7 @@ struct EHCIState {
extern const VMStateDescription vmstate_ehci;
-void usb_ehci_initfn(EHCIState *s, DeviceState *dev);
+void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp);
#define TYPE_PCI_EHCI "pci-ehci-usb"
#define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI)
--
1.7.9.7
- [Qemu-devel] [PULL 0/9] usb patch queue, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 1/9] usb/hcd-ehci-sysbus: Convert to QOM realize,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 6/9] usb/host-libusb: Fix building with libusb git master code, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 3/9] usb/hcd-ehci: Add Tegra2 SysBus EHCI device, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 9/9] usb: fix serial number for hid devices, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 7/9] usb-host-libusb: set USB_DEV_FLAG_IS_HOST, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 8/9] usb: add serial bus property, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 2/9] usb/hcd-ehci: Split off instance_init from realize, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 5/9] usb/hcd-ehci: Add Faraday FUSBH200 support, Gerd Hoffmann, 2013/06/24
- [Qemu-devel] [PATCH 4/9] usb/hcd-ehci: Replace PORTSC macros with variables, Gerd Hoffmann, 2013/06/24