Skip to content
  • Gerd Hoffmann's avatar
    usb: claim port at device initialization time. · 891fb2cd
    Gerd Hoffmann authored
    
    
    This patch makes qemu assign a port when creating the device, not when
    attaching it.  For most usb devices this isn't a noticable difference
    because they are in attached state all the time.
    
    The change affects usb-host devices which live in detached state while
    the real device is unplugged from the host.  They have a fixed port
    assigned all the time now instead of getting grabbing one on attach and
    releasing it at detach, i.e. they stop floating around at the usb bus.
    
    The change also allows to simplify usb-hub.  It doesn't need the
    handle_attach() callback any more to configure the downstream ports.
    This can be done at device initialitation time now.  The changed
    initialization order (first grab upstream port, then register downstream
    ports) also fixes some icky corner cases.  For example it is not possible
    any more to plug the hub into one of its own downstream ports.
    
    The usb host adapters must care too.  USBPort->dev being non-NULL
    doesn't imply any more the device is in attached state.  The host
    adapters must additionally check the USBPort->dev->attached flag.
    
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    891fb2cd