Revision 72cf2d4f hw/usb-bus.c

b/hw/usb-bus.c
12 12
    .print_dev = usb_bus_dev_print,
13 13
};
14 14
static int next_usb_bus = 0;
15
static TAILQ_HEAD(, USBBus) busses = TAILQ_HEAD_INITIALIZER(busses);
15
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
16 16

  
17 17
USBBus *usb_bus_new(DeviceState *host)
18 18
{
......
20 20

  
21 21
    bus = FROM_QBUS(USBBus, qbus_create(&usb_bus_info, host, NULL));
22 22
    bus->busnr = next_usb_bus++;
23
    TAILQ_INIT(&bus->free);
24
    TAILQ_INIT(&bus->used);
25
    TAILQ_INSERT_TAIL(&busses, bus, next);
23
    QTAILQ_INIT(&bus->free);
24
    QTAILQ_INIT(&bus->used);
25
    QTAILQ_INSERT_TAIL(&busses, bus, next);
26 26
    return bus;
27 27
}
28 28

  
......
31 31
    USBBus *bus;
32 32

  
33 33
    if (-1 == busnr)
34
        return TAILQ_FIRST(&busses);
35
    TAILQ_FOREACH(bus, &busses, next) {
34
        return QTAILQ_FIRST(&busses);
35
    QTAILQ_FOREACH(bus, &busses, next) {
36 36
        if (bus->busnr == busnr)
37 37
            return bus;
38 38
    }
......
100 100
    port->opaque = opaque;
101 101
    port->index = index;
102 102
    port->attach = attach;
103
    TAILQ_INSERT_TAIL(&bus->free, port, next);
103
    QTAILQ_INSERT_TAIL(&bus->free, port, next);
104 104
    bus->nfree++;
105 105
}
106 106

  
......
116 116
    }
117 117
    dev->attached++;
118 118

  
119
    port = TAILQ_FIRST(&bus->free);
120
    TAILQ_REMOVE(&bus->free, port, next);
119
    port = QTAILQ_FIRST(&bus->free);
120
    QTAILQ_REMOVE(&bus->free, port, next);
121 121
    bus->nfree--;
122 122

  
123 123
    usb_attach(port, dev);
124 124

  
125
    TAILQ_INSERT_TAIL(&bus->used, port, next);
125
    QTAILQ_INSERT_TAIL(&bus->used, port, next);
126 126
    bus->nused++;
127 127
}
128 128

  
......
149 149
    if (!bus)
150 150
        return -1;
151 151

  
152
    TAILQ_FOREACH(port, &bus->used, next) {
152
    QTAILQ_FOREACH(port, &bus->used, next) {
153 153
        if (port->dev->addr == addr)
154 154
            break;
155 155
    }
......
157 157
        return -1;
158 158

  
159 159
    dev = port->dev;
160
    TAILQ_REMOVE(&bus->used, port, next);
160
    QTAILQ_REMOVE(&bus->used, port, next);
161 161
    bus->nused--;
162 162

  
163 163
    usb_attach(port, NULL);
164 164
    dev->info->handle_destroy(dev);
165 165

  
166
    TAILQ_INSERT_TAIL(&bus->free, port, next);
166
    QTAILQ_INSERT_TAIL(&bus->free, port, next);
167 167
    bus->nfree++;
168 168
    return 0;
169 169
}
......
196 196
    USBDevice *dev;
197 197
    USBPort *port;
198 198

  
199
    if (TAILQ_EMPTY(&busses)) {
199
    if (QTAILQ_EMPTY(&busses)) {
200 200
        monitor_printf(mon, "USB support not enabled\n");
201 201
        return;
202 202
    }
203 203

  
204
    TAILQ_FOREACH(bus, &busses, next) {
205
        TAILQ_FOREACH(port, &bus->used, next) {
204
    QTAILQ_FOREACH(bus, &busses, next) {
205
        QTAILQ_FOREACH(port, &bus->used, next) {
206 206
            dev = port->dev;
207 207
            if (!dev)
208 208
                continue;

Also available in: Unified diff