Blame 0127-usb-core-Don-t-set-packet-state-to-complete-on-a-nak.patch

5544c1
From bcd7c845fbfbafe03e320fbffcaa32417cfd5267 Mon Sep 17 00:00:00 2001
Hans de Goede c8dfc6
From: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Date: Mon, 3 Sep 2012 12:33:44 +0200
5544c1
Subject: [PATCH] usb-core: Don't set packet state to complete on a nak
Hans de Goede c8dfc6
Hans de Goede c8dfc6
This way the hcd can re-use the same packet to retry without needing
Hans de Goede c8dfc6
to re-init it.
Hans de Goede c8dfc6
Hans de Goede c8dfc6
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede c8dfc6
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5544c1
(cherry picked from commit cc40997489260f405aecccd30d4626ceee862502)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Hans de Goede c8dfc6
---
Hans de Goede c8dfc6
 hw/usb/core.c | 6 ++++--
Hans de Goede c8dfc6
 1 file changed, 4 insertions(+), 2 deletions(-)
Hans de Goede c8dfc6
Hans de Goede c8dfc6
diff --git a/hw/usb/core.c b/hw/usb/core.c
Hans de Goede c8dfc6
index 2da38e7..be6d936 100644
Hans de Goede c8dfc6
--- a/hw/usb/core.c
Hans de Goede c8dfc6
+++ b/hw/usb/core.c
Hans de Goede c8dfc6
@@ -399,8 +399,10 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
Hans de Goede c8dfc6
              * otherwise packets can complete out of order!
Hans de Goede c8dfc6
              */
Hans de Goede c8dfc6
             assert(!p->ep->pipeline);
Hans de Goede c8dfc6
-            p->result = ret;
Hans de Goede c8dfc6
-            usb_packet_set_state(p, USB_PACKET_COMPLETE);
Hans de Goede c8dfc6
+            if (ret != USB_RET_NAK) {
Hans de Goede c8dfc6
+                p->result = ret;
Hans de Goede c8dfc6
+                usb_packet_set_state(p, USB_PACKET_COMPLETE);
Hans de Goede c8dfc6
+            }
Hans de Goede c8dfc6
         }
Hans de Goede c8dfc6
     } else {
Hans de Goede c8dfc6
         ret = USB_RET_ASYNC;
Hans de Goede c8dfc6
-- 
5544c1
1.7.12.1
Hans de Goede c8dfc6