usb: add usb_pick_speed
commitb791c3b38c7969cb9f4acda8229e19fd865a1c08
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 23 May 2014 14:20:54 +0000 (23 16:20 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 2 Jun 2014 14:29:00 +0000 (2 16:29 +0200)
tree2c239c2e37373914733ad011c50fd4a29c4c6f4a
parent322fd1f4f7c884c75749398bf48e01bd4b226e9f
usb: add usb_pick_speed

We can pick the usb port speed in generic code, by looking at the port
and device speed masks and looking for the fastest match.  So add a
function to do exactly that, and drop the speed setting code from
usb_desc_attach as it isn't needed any more.

This way we can set the device speed before calling port->ops->attach,
which fixes some xhci hotplug issues.

https://bugzilla.redhat.com/show_bug.cgi?id=1046873

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/core.c
hw/usb/desc.c
include/hw/usb.h