qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Andreas Färber" <afaerber@suse.de>,
	anthony@codemonkey.ws, "Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 07/16] usb: Pass size to usb_bus_new()
Date: Sat, 24 Aug 2013 02:00:27 +0200	[thread overview]
Message-ID: <1377302436-25193-8-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1377302436-25193-1-git-send-email-afaerber@suse.de>

To be passed to qbus_create_inplace().

Use DEVICE() cast to avoid a direct parent field access.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/usb/bus.c      | 3 ++-
 hw/usb/hcd-ehci.c | 2 +-
 hw/usb/hcd-musb.c | 2 +-
 hw/usb/hcd-ohci.c | 2 +-
 hw/usb/hcd-uhci.c | 2 +-
 hw/usb/hcd-xhci.c | 2 +-
 include/hw/usb.h  | 3 ++-
 7 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index f83d1de..6aee262 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -67,7 +67,8 @@ const VMStateDescription vmstate_usb_device = {
     }
 };
 
-void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host)
+void usb_bus_new(USBBus *bus, size_t bus_size,
+                 USBBusOps *ops, DeviceState *host)
 {
     qbus_create_inplace(&bus->qbus, TYPE_USB_BUS, host, NULL);
     bus->ops = ops;
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 010a0d0..540431a 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2520,7 +2520,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
         return;
     }
 
-    usb_bus_new(&s->bus, &ehci_bus_ops, dev);
+    usb_bus_new(&s->bus, sizeof(s->bus), &ehci_bus_ops, dev);
     for (i = 0; i < s->portnr; i++) {
         usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
                           USB_SPEED_MASK_HIGH);
diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c
index 7968e17..251309f 100644
--- a/hw/usb/hcd-musb.c
+++ b/hw/usb/hcd-musb.c
@@ -383,7 +383,7 @@ struct MUSBState *musb_init(DeviceState *parent_device, int gpio_base)
 
     musb_reset(s);
 
-    usb_bus_new(&s->bus, &musb_bus_ops, parent_device);
+    usb_bus_new(&s->bus, sizeof(s->bus), &musb_bus_ops, parent_device);
     usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
                       USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
 
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index d7836d6..c4a21bc 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1881,7 +1881,7 @@ static int usb_ohci_init(OHCIState *ohci, DeviceState *dev,
             return -1;
         }
     } else {
-        usb_bus_new(&ohci->bus, &ohci_bus_ops, dev);
+        usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev);
         for (i = 0; i < num_ports; i++) {
             usb_register_port(&ohci->bus, &ohci->rhport[i].port,
                               ohci, i, &ohci_port_ops,
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index ac82833..f142abc 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1253,7 +1253,7 @@ static int usb_uhci_common_initfn(PCIDevice *dev)
             return -1;
         }
     } else {
-        usb_bus_new(&s->bus, &uhci_bus_ops, &s->dev.qdev);
+        usb_bus_new(&s->bus, sizeof(s->bus), &uhci_bus_ops, DEVICE(dev));
         for (i = 0; i < NB_PORTS; i++) {
             usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 58c88b8..1879cf5 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -3309,7 +3309,7 @@ static void usb_xhci_init(XHCIState *xhci)
     usbports = MAX(xhci->numports_2, xhci->numports_3);
     xhci->numports = xhci->numports_2 + xhci->numports_3;
 
-    usb_bus_new(&xhci->bus, &xhci_bus_ops, dev);
+    usb_bus_new(&xhci->bus, sizeof(xhci->bus), &xhci_bus_ops, dev);
 
     for (i = 0; i < usbports; i++) {
         speedmask = 0;
diff --git a/include/hw/usb.h b/include/hw/usb.h
index 901b0da..1b8acba 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -496,7 +496,8 @@ struct USBBusOps {
     void (*wakeup_endpoint)(USBBus *bus, USBEndpoint *ep, unsigned int stream);
 };
 
-void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host);
+void usb_bus_new(USBBus *bus, size_t bus_size,
+                 USBBusOps *ops, DeviceState *host);
 USBBus *usb_bus_find(int busnr);
 void usb_legacy_register(const char *typename, const char *usbdevice_name,
                          USBDevice *(*usbdevice_init)(USBBus *bus,
-- 
1.8.1.4

  parent reply	other threads:[~2013-08-24  0:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-24  0:00 [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 01/16] qom: Fix object_initialize_with_type() argument name in documentation Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 02/16] intel-hda: Pass size to hda_codec_bus_init() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 03/16] ipack: Pass size to ipack_bus_new_inplace() Andreas Färber
2013-08-26  7:23   ` Wenchao Xia
2013-08-24  0:00 ` [Qemu-devel] [PATCH 04/16] ide: Pass size to ide_bus_new() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 05/16] pci: Pass size to pci_bus_new_inplace() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 06/16] scsi: Pass size to scsi_bus_new() Andreas Färber
2013-08-26  8:01   ` Paolo Bonzini
2013-08-24  0:00 ` Andreas Färber [this message]
2013-08-24  0:00 ` [Qemu-devel] [PATCH 08/16] virtio-pci: Pass size to virtio_pci_bus_new() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 09/16] s390-virtio-bus: Pass size to virtio_s390_bus_new() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 10/16] virtio-ccw: Pass size to virtio_ccw_bus_new() Andreas Färber
2013-08-26  8:00   ` Cornelia Huck
2013-08-24  0:00 ` [Qemu-devel] [PATCH 11/16] virtio-mmio: Pass size to virtio_mmio_bus_new() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 12/16] qdev: Pass size to qbus_create_inplace() Andreas Färber
2013-08-26  7:44   ` Wenchao Xia
2013-08-30 17:12     ` Andreas Färber
2013-08-26  8:03   ` Cornelia Huck
2013-08-30 17:05     ` Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 13/16] qom: Pass available size to object_initialize() Andreas Färber
2013-08-26  8:09   ` Cornelia Huck
2013-08-26  8:11   ` Wenchao Xia
2013-08-30 17:14     ` Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 14/16] qom: Introduce type_get_instance_size() Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 15/16] qdev-monitor: Clean up qdev_device_add() variable naming Andreas Färber
2013-08-26  7:52   ` Wenchao Xia
2013-08-30 17:19     ` Andreas Färber
2013-09-12 14:40       ` Andreas Färber
2013-08-24  0:00 ` [Qemu-devel] [PATCH 16/16] qdev-monitor: Avoid aborting on out-of-memory in qdev_device_add() Andreas Färber
2013-08-26  8:12 ` [Qemu-devel] [PATCH 00/16] qom: Assert sufficient object instance size Wenchao Xia
2013-08-30 19:37 ` Andreas Färber

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=1377302436-25193-8-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=kraxel@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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).