qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 03/13] ohci: Complete conversion to realize
Date: Wed, 18 Mar 2015 14:07:45 +0100	[thread overview]
Message-ID: <1426684075-27224-4-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1426684075-27224-1-git-send-email-kraxel@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

Commit 457215ec "ohci: Use QOM realize for OHCI" converted only
"sysbus-ohci".  Finish the job: convert "pci-ohci".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ohci.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 21ec65f..e180a17 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1827,10 +1827,10 @@ static USBPortOps ohci_port_ops = {
 static USBBusOps ohci_bus_ops = {
 };
 
-static int usb_ohci_init(OHCIState *ohci, DeviceState *dev,
-                         int num_ports, dma_addr_t localmem_base,
-                         char *masterbus, uint32_t firstport,
-                         AddressSpace *as)
+static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
+                          int num_ports, dma_addr_t localmem_base,
+                          char *masterbus, uint32_t firstport,
+                          AddressSpace *as, Error **errp)
 {
     Error *err = NULL;
     int i;
@@ -1863,8 +1863,8 @@ static int usb_ohci_init(OHCIState *ohci, DeviceState *dev,
                                USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL,
                                &err);
         if (err) {
-            error_report_err(err);
-            return -1;
+            error_propagate(errp, err);
+            return;
         }
     } else {
         usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev);
@@ -1884,8 +1884,6 @@ static int usb_ohci_init(OHCIState *ohci, DeviceState *dev,
 
     ohci->async_td = 0;
     qemu_register_reset(ohci_reset, ohci);
-
-    return 0;
 }
 
 #define TYPE_PCI_OHCI "pci-ohci"
@@ -1918,22 +1916,24 @@ static void ohci_die(OHCIState *ohci)
                  PCI_STATUS_DETECTED_PARITY);
 }
 
-static int usb_ohci_initfn_pci(PCIDevice *dev)
+static void usb_ohci_realize_pci(PCIDevice *dev, Error **errp)
 {
+    Error *err = NULL;
     OHCIPCIState *ohci = PCI_OHCI(dev);
 
     dev->config[PCI_CLASS_PROG] = 0x10; /* OHCI */
     dev->config[PCI_INTERRUPT_PIN] = 0x01; /* interrupt pin A */
 
-    if (usb_ohci_init(&ohci->state, DEVICE(dev), ohci->num_ports, 0,
-                      ohci->masterbus, ohci->firstport,
-                      pci_get_address_space(dev)) != 0) {
-        return -1;
+    usb_ohci_init(&ohci->state, DEVICE(dev), ohci->num_ports, 0,
+                  ohci->masterbus, ohci->firstport,
+                  pci_get_address_space(dev), &err);
+    if (err) {
+        error_propagate(errp, err);
+        return;
     }
-    ohci->state.irq = pci_allocate_irq(dev);
 
+    ohci->state.irq = pci_allocate_irq(dev);
     pci_register_bar(dev, 0, 0, &ohci->state.mem);
-    return 0;
 }
 
 static void usb_ohci_exit(PCIDevice *dev)
@@ -1975,7 +1975,7 @@ static void ohci_realize_pxa(DeviceState *dev, Error **errp)
 
     /* Cannot fail as we pass NULL for masterbus */
     usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, NULL, 0,
-                  &address_space_memory);
+                  &address_space_memory, &error_abort);
     sysbus_init_irq(sbd, &s->ohci.irq);
     sysbus_init_mmio(sbd, &s->ohci.mem);
 }
@@ -2091,7 +2091,7 @@ static void ohci_pci_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
-    k->init = usb_ohci_initfn_pci;
+    k->realize = usb_ohci_realize_pci;
     k->exit = usb_ohci_exit;
     k->vendor_id = PCI_VENDOR_ID_APPLE;
     k->device_id = PCI_DEVICE_ID_APPLE_IPID_USB;
-- 
1.8.3.1

  parent reply	other threads:[~2015-03-18 13:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18 13:07 [Qemu-devel] [PULL for-2.3 00/13] usb patch queue Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 01/13] usb: Propagate errors through usb_register_companion() Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 02/13] usb: Improve companion configuration error messages Gerd Hoffmann
2015-03-18 13:07 ` Gerd Hoffmann [this message]
2015-03-18 13:07 ` [Qemu-devel] [PULL 04/13] uhci: Convert to realize Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 05/13] monitor: Drop dead QMP check from monitor_read_password() Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 06/13] monitor: Plug memory leak in monitor_read_bdrv_key_start() Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 07/13] monitor usb: Inline monitor_read_bdrv_key_start()'s first part Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 08/13] usb/dev-storage: Fix QMP device_add missing encryption key failure Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 09/13] usb/dev-storage: Avoid qerror_report_err() outside QMP handlers Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 10/13] hw/usb: Include USB files only if necessary Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 11/13] uhci: fix segfault when hot-unplugging uhci controller Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 12/13] ohci: fix resource cleanup leak Gerd Hoffmann
2015-03-18 13:07 ` [Qemu-devel] [PULL 13/13] ehci: fix segfault when hot-unplugging ehci controller Gerd Hoffmann
2015-03-19 12:11 ` [Qemu-devel] [PULL for-2.3 00/13] usb patch queue Peter Maydell
2015-03-19 14:50   ` Gerd Hoffmann
2015-03-19 19:00     ` Peter Maydell
2015-03-19 19:33       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426684075-27224-4-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).