[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/17] usb: Pass size to usb_bus_new()
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PULL 09/17] usb: Pass size to usb_bus_new() |
Date: |
Fri, 30 Aug 2013 21:29:35 +0200 |
To be passed to qbus_create_inplace().
Use DEVICE() cast to avoid a direct parent field access.
Reviewed-by: Wenchao Xia <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
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 e5523d5..137e200 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 f91aa55..66bc61a 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 39a25a7..35f0878 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 578b949..becc7fa 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1254,7 +1254,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 be6b86e..d5c6588 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
- [Qemu-devel] [PULL 00/17] QOM devices patch queue 2013-08-30, Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 01/17] object: Fix typo in qom/object.h, Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 02/17] virtio: Remove unnecessary OBJECT() casts, Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 03/17] qom: Fix object_initialize_with_type() argument name in documentation, Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 04/17] intel-hda: Pass size to hda_codec_bus_init(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 06/17] ide: Pass size to ide_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 05/17] ipack: Pass size to ipack_bus_new_inplace(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 07/17] pci: Pass size to pci_bus_new_inplace(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 08/17] scsi: Pass size to scsi_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 09/17] usb: Pass size to usb_bus_new(),
Andreas Färber <=
- [Qemu-devel] [PULL 10/17] virtio-pci: Pass size to virtio_pci_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 11/17] s390-virtio-bus: Pass size to virtio_s390_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 12/17] virtio-ccw: Pass size to virtio_ccw_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 13/17] virtio-mmio: Pass size to virtio_mmio_bus_new(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 14/17] qdev: Pass size to qbus_create_inplace(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 16/17] qom: Assert instance size in object_initialize_with_type(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 17/17] isa: Fix documentation of isa_register_portio_list(), Andreas Färber, 2013/08/30
- [Qemu-devel] [PULL 15/17] qom: Pass available size to object_initialize(), Andreas Färber, 2013/08/30