usb: queue can have async packets
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 28 Feb 2012 14:36:06 +0000 (15:36 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Wed, 7 Mar 2012 11:28:05 +0000 (12:28 +0100)
This can happen today in case the ->complete() callback queues up the
next packet.  Also we'll support pipelining soon, which allows to have
multiple packets per queue in flight (aka ASYNC) state.

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

index 57fc5e3cfd9f5d25f5de55650b22a5660b740c8f..fc41d62438591147429d210e72c6595278e219cb 100644 (file)
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -356,6 +356,9 @@ void usb_packet_complete(USBDevice *dev, USBPacket *p)
 
     while (!QTAILQ_EMPTY(&ep->queue)) {
         p = QTAILQ_FIRST(&ep->queue);
+        if (p->state == USB_PACKET_ASYNC) {
+            break;
+        }
         assert(p->state == USB_PACKET_QUEUED);
         ret = usb_process_one(p);
         if (ret == USB_RET_ASYNC) {