From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0W7-0004qQ-2H for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ur0W5-0000Hb-Tw for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:44:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48594) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ur0W5-0000HM-Ma for qemu-devel@nongnu.org; Mon, 24 Jun 2013 02:44:45 -0400 From: Gerd Hoffmann Date: Mon, 24 Jun 2013 08:44:35 +0200 Message-Id: <1372056283-4845-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1372056283-4845-1-git-send-email-kraxel@redhat.com> References: <1372056283-4845-1-git-send-email-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 1/9] usb/hcd-ehci-sysbus: Convert to QOM realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Gerd Hoffmann From: Andreas F=C3=A4rber 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=C3=A4rber Signed-off-by: Gerd Hoffmann --- 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 =3D 0x00; s->opregbase =3D 0x20; =20 - 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); =20 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[] =3D { DEFINE_PROP_END_OF_LIST(), }; =20 -static int usb_ehci_sysbus_initfn(SysBusDevice *dev) +static void usb_ehci_sysbus_realize(DeviceState *dev, Error **errp) { + SysBusDevice *d =3D SYS_BUS_DEVICE(dev); EHCISysBusState *i =3D SYS_BUS_EHCI(dev); SysBusEHCIClass *sec =3D SYS_BUS_EHCI_GET_CLASS(dev); EHCIState *s =3D &i->ehci; @@ -42,18 +43,16 @@ static int usb_ehci_sysbus_initfn(SysBusDevice *dev) s->opregbase =3D sec->opregbase; s->as =3D &address_space_memory; =20 - 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); } =20 static void ehci_sysbus_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); - SysBusDeviceClass *k =3D SYS_BUS_DEVICE_CLASS(klass); =20 - k->init =3D usb_ehci_sysbus_initfn; + dc->realize =3D usb_ehci_sysbus_realize; dc->vmsd =3D &vmstate_ehci_sysbus; dc->props =3D 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 =3D { } }; =20 -void usb_ehci_initfn(EHCIState *s, DeviceState *dev) +void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) { int i; =20 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 { =20 extern const VMStateDescription vmstate_ehci; =20 -void usb_ehci_initfn(EHCIState *s, DeviceState *dev); +void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp); =20 #define TYPE_PCI_EHCI "pci-ehci-usb" #define PCI_EHCI(obj) OBJECT_CHECK(EHCIPCIState, (obj), TYPE_PCI_EHCI) --=20 1.7.9.7