usb: Move (initial) call of usb_port_location to usb_fill_port

Cleanup / preparation patch for companion controller support. Note that
as a "side-effect" this patch also fixes the milkymist-softusb controller
not having a port_location set for its ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Hans de Goede 2011-06-30 12:05:19 +02:00 committed by Gerd Hoffmann
parent 090ac6425a
commit 3631e6c8c2
5 changed files with 1 additions and 4 deletions

View File

@ -149,6 +149,7 @@ static void usb_fill_port(USBPort *port, void *opaque, int index,
port->index = index; port->index = index;
port->ops = ops; port->ops = ops;
port->speedmask = speedmask; port->speedmask = speedmask;
usb_port_location(port, NULL, index + 1);
} }
void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index,

View File

@ -2206,7 +2206,6 @@ static int usb_ehci_initfn(PCIDevice *dev)
for(i = 0; i < NB_PORTS; i++) { for(i = 0; i < NB_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops, usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
USB_SPEED_MASK_HIGH); USB_SPEED_MASK_HIGH);
usb_port_location(&s->ports[i], NULL, i+1);
s->ports[i].dev = 0; s->ports[i].dev = 0;
} }

View File

@ -369,7 +369,6 @@ struct MUSBState *musb_init(qemu_irq *irqs)
usb_bus_new(&s->bus, &musb_bus_ops, NULL /* FIXME */); usb_bus_new(&s->bus, &musb_bus_ops, NULL /* FIXME */);
usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops, usb_register_port(&s->bus, &s->port, s, 0, &musb_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
usb_port_location(&s->port, NULL, 1);
return s; return s;
} }

View File

@ -1742,7 +1742,6 @@ static void usb_ohci_init(OHCIState *ohci, DeviceState *dev,
for (i = 0; i < num_ports; i++) { for (i = 0; i < num_ports; i++) {
usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops, usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
usb_port_location(&ohci->rhport[i].port, NULL, i+1);
} }
ohci->async_td = 0; ohci->async_td = 0;

View File

@ -1129,7 +1129,6 @@ static int usb_uhci_common_initfn(PCIDevice *dev)
for(i = 0; i < NB_PORTS; i++) { for(i = 0; i < NB_PORTS; i++) {
usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops, usb_register_port(&s->bus, &s->ports[i].port, s, i, &uhci_port_ops,
USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
usb_port_location(&s->ports[i].port, NULL, i+1);
} }
s->frame_timer = qemu_new_timer_ns(vm_clock, uhci_frame_timer, s); s->frame_timer = qemu_new_timer_ns(vm_clock, uhci_frame_timer, s);
s->num_ports_vmstate = NB_PORTS; s->num_ports_vmstate = NB_PORTS;