Revision ae60fea9 hw/usb-bus.c

b/hw/usb-bus.c
160 160
    bus->nfree++;
161 161
}
162 162

  
163
int usb_register_companion(const char *masterbus, USBPort *ports[],
164
                           uint32_t portcount, uint32_t firstport,
165
                           void *opaque, USBPortOps *ops, int speedmask)
166
{
167
    USBBus *bus;
168
    int i;
169

  
170
    QTAILQ_FOREACH(bus, &busses, next) {
171
        if (strcmp(bus->qbus.name, masterbus) == 0) {
172
            break;
173
        }
174
    }
175

  
176
    if (!bus || !bus->ops->register_companion) {
177
        qerror_report(QERR_INVALID_PARAMETER_VALUE, "masterbus",
178
                      "an USB masterbus");
179
        if (bus) {
180
            error_printf_unless_qmp(
181
                "USB bus '%s' does not allow companion controllers\n",
182
                masterbus);
183
        }
184
        return -1;
185
    }
186

  
187
    for (i = 0; i < portcount; i++) {
188
        usb_fill_port(ports[i], opaque, i, ops, speedmask);
189
    }
190

  
191
    return bus->ops->register_companion(bus, ports, portcount, firstport);
192
}
193

  
163 194
void usb_port_location(USBPort *downstream, USBPort *upstream, int portnr)
164 195
{
165 196
    if (upstream) {

Also available in: Unified diff