From 2dab770d9a3a72a14b00b39abdee49f06906a8eb Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 21 Sep 2012 18:57:33 -0300
Subject: [RHEL6 qemu-kvm PATCH 12/23] ehci: simplify ehci_state_executing

RH-Author: Hans de Goede <hdegoede@redhat.com>
Message-id: <1348253864-3050-12-git-send-email-hdegoede@redhat.com>
Patchwork-id: 42188
O-Subject: [RHEL-6.4 qemu-kvm PATCH 11/22] ehci: simplify ehci_state_executing
Bugzilla: 805172
RH-Acked-by: Uri Lublin <uril@redhat.com>
RH-Acked-by: Arnon Gilboa <agilboa@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>

ehci_state_executing does not need to check for p->usb_status == USB_RET_ASYNC
or USB_RET_PROCERR, since ehci_execute_complete already does a similar check
and will trigger an assert if either value is encountered.

USB_RET_ASYNC should never be the packet status when execute_complete runs
for obvious reasons, and USB_RET_PROCERR is only used by ehci_state_execute /
ehci_execute not by ehci_state_executing / ehci_execute_complete.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Upstream commit: 574ef17191f5ec5a3cc4782c1f59dc5eb8279654
Conflicts: hw/usb-ehci.c
---
 hw/usb-ehci.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/usb-ehci.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 22b106a..22abc55 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -1882,16 +1882,7 @@ out:
 
 static int ehci_state_executing(EHCIQueue *q, int async)
 {
-    int again = 0;
-
     ehci_execute_complete(q);
-    if (q->usb_status == USB_RET_ASYNC) {
-        goto out;
-    }
-    if (q->usb_status == USB_RET_PROCERR) {
-        again = -1;
-        goto out;
-    }
 
     // 4.10.3
     if (!async) {
@@ -1909,11 +1900,8 @@ static int ehci_state_executing(EHCIQueue *q, int async)
         ehci_set_state(q->ehci, async, EST_WRITEBACK);
     }
 
-    again = 1;
-
-out:
     ehci_flush_qh(q);
-    return again;
+    return 1;
 }
 
 
-- 
1.7.11.4