[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/24] switch usb bus to inplace allocation.
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 04/24] switch usb bus to inplace allocation. |
Date: |
Fri, 25 Sep 2009 21:42:29 +0200 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb-bus.c | 7 ++-----
hw/usb-musb.c | 6 +++---
hw/usb-ohci.c | 6 +++---
hw/usb-uhci.c | 6 +++---
hw/usb.h | 2 +-
5 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 03933f1..2cac1e8 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -14,16 +14,13 @@ static struct BusInfo usb_bus_info = {
static int next_usb_bus = 0;
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
-USBBus *usb_bus_new(DeviceState *host)
+void usb_bus_new(USBBus *bus, DeviceState *host)
{
- USBBus *bus;
-
- bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL));
+ qbus_create_inplace(&bus->qbus, &usb_bus_info, host, NULL);
bus->busnr = next_usb_bus++;
QTAILQ_INIT(&bus->free);
QTAILQ_INIT(&bus->used);
QTAILQ_INSERT_TAIL(&busses, bus, next);
- return bus;
}
USBBus *usb_bus_find(int busnr)
diff --git a/hw/usb-musb.c b/hw/usb-musb.c
index 9eb0d63..09ec5a1 100644
--- a/hw/usb-musb.c
+++ b/hw/usb-musb.c
@@ -281,7 +281,7 @@ typedef struct {
struct MUSBState {
qemu_irq *irqs;
- USBBus *bus;
+ USBBus bus;
USBPort port;
int idx;
@@ -331,8 +331,8 @@ struct MUSBState {
s->ep[i].epnum = i;
}
- s->bus = usb_bus_new(NULL /* FIXME */);
- usb_register_port(s->bus, &s->port, s, 0, musb_attach);
+ usb_bus_new(&s->bus, NULL /* FIXME */);
+ usb_register_port(&s->bus, &s->port, s, 0, musb_attach);
return s;
}
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 6e428c4..48ccd49 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -65,7 +65,7 @@ enum ohci_type {
};
typedef struct {
- USBBus *bus;
+ USBBus bus;
qemu_irq irq;
enum ohci_type type;
int mem;
@@ -1690,10 +1690,10 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState
*dev,
ohci->irq = irq;
ohci->type = type;
- ohci->bus = usb_bus_new(dev);
+ usb_bus_new(&ohci->bus, dev);
ohci->num_ports = num_ports;
for (i = 0; i < num_ports; i++) {
- usb_register_port(ohci->bus, &ohci->rhport[i].port, ohci, i,
ohci_attach);
+ usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i,
ohci_attach);
}
ohci->async_td = 0;
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 6807413..a3ed9b2 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -122,7 +122,7 @@ typedef struct UHCIPort {
typedef struct UHCIState {
PCIDevice dev;
- USBBus *bus;
+ USBBus bus;
uint16_t cmd; /* cmd register */
uint16_t status;
uint16_t intr; /* interrupt enable register */
@@ -1083,9 +1083,9 @@ static int usb_uhci_common_initfn(UHCIState *s)
pci_conf[0x3d] = 4; // interrupt pin 3
pci_conf[0x60] = 0x10; // release number
- s->bus = usb_bus_new(&s->dev.qdev);
+ usb_bus_new(&s->bus, &s->dev.qdev);
for(i = 0; i < NB_PORTS; i++) {
- usb_register_port(s->bus, &s->ports[i].port, s, i, uhci_attach);
+ usb_register_port(&s->bus, &s->ports[i].port, s, i, uhci_attach);
}
s->frame_timer = qemu_new_timer(vm_clock, uhci_frame_timer, s);
diff --git a/hw/usb.h b/hw/usb.h
index 7c5cf83..467cddb 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -303,7 +303,7 @@ struct USBBus {
QTAILQ_ENTRY(USBBus) next;
};
-USBBus *usb_bus_new(DeviceState *host);
+void usb_bus_new(USBBus *bus, DeviceState *host);
USBBus *usb_bus_find(int busnr);
void usb_qdev_register(USBDeviceInfo *info);
void usb_qdev_register_many(USBDeviceInfo *info);
--
1.6.2.5
- [Qemu-devel] [PATCH 00/24] qdev: bus management updates., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 01/24] unbreak usb pass-through on linux., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 05/24] switch ide bus to inplace allocation., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 04/24] switch usb bus to inplace allocation.,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 03/24] switch scsi bus to inplace allocation., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 06/24] inplace allocation for pci, split irq init., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 02/24] allow qdev busses allocations be inplace, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 08/24] piix_pci: kill PIIX3IrqState, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 10/24] Add exit callback to DeviceInfo., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 12/24] pci: use qdev for device destruction., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 07/24] convert pci bridge to qdev, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 13/24] pci: move unregister from PCIDevice to PCIDeviceInfo, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 11/24] Implement scsi device destruction, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 09/24] qdev: device free fixups., Gerd Hoffmann, 2009/09/25