]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xhci: Fix command ring stop regression in 4.11
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 17 May 2017 15:32:05 +0000 (18:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 May 2017 13:19:42 +0000 (15:19 +0200)
In 4.11 TRB completion codes were renamed to match spec.

Completion codes for command ring stopped and endpoint stopped
were mixed, leading to failures while handling a stopped command ring.

Use the correct completion code for command ring stopped events.

Fixes: 6201a1e6400c ("usb: host: xhci: rename completion codes to match spec")
Cc: <stable@vger.kernel.org> # 4.11
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c

index 5e3e9d4c6956bab71a815a86ef8e658cce12b48e..0dde49c35dd23d858feb2d537840b568fd1c4643 100644 (file)
@@ -419,7 +419,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
        wait_for_completion(cmd->completion);
 
        if (cmd->status == COMP_COMMAND_ABORTED ||
-                       cmd->status == COMP_STOPPED) {
+           cmd->status == COMP_COMMAND_RING_STOPPED) {
                xhci_warn(xhci, "Timeout while waiting for stop endpoint command\n");
                ret = -ETIME;
        }
index 6d2492c1c6432b45f6398deb0373ee627f1cb899..03f63f50afb6213d58b498f559021db28f8a4d5a 100644 (file)
@@ -323,7 +323,7 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
                if (i_cmd->status != COMP_COMMAND_ABORTED)
                        continue;
 
-               i_cmd->status = COMP_STOPPED;
+               i_cmd->status = COMP_COMMAND_RING_STOPPED;
 
                xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
                         i_cmd->command_trb);
@@ -1380,7 +1380,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
        cmd_comp_code = GET_COMP_CODE(le32_to_cpu(event->status));
 
        /* If CMD ring stopped we own the trbs between enqueue and dequeue */
-       if (cmd_comp_code == COMP_STOPPED) {
+       if (cmd_comp_code == COMP_COMMAND_RING_STOPPED) {
                complete_all(&xhci->cmd_ring_stop_completion);
                return;
        }
@@ -1436,8 +1436,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
                break;
        case TRB_CMD_NOOP:
                /* Is this an aborted command turned to NO-OP? */
-               if (cmd->status == COMP_STOPPED)
-                       cmd_comp_code = COMP_STOPPED;
+               if (cmd->status == COMP_COMMAND_RING_STOPPED)
+                       cmd_comp_code = COMP_COMMAND_RING_STOPPED;
                break;
        case TRB_RESET_EP:
                WARN_ON(slot_id != TRB_TO_SLOT_ID(
index 71eb2991c6984a0f75507f1c0b6c5f3635f3ecae..30f47d92a6104ef52ae5e782e1f305fa0a517cad 100644 (file)
@@ -1764,7 +1764,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
 
        switch (*cmd_status) {
        case COMP_COMMAND_ABORTED:
-       case COMP_STOPPED:
+       case COMP_COMMAND_RING_STOPPED:
                xhci_warn(xhci, "Timeout while waiting for configure endpoint command\n");
                ret = -ETIME;
                break;
@@ -1814,7 +1814,7 @@ static int xhci_evaluate_context_result(struct xhci_hcd *xhci,
 
        switch (*cmd_status) {
        case COMP_COMMAND_ABORTED:
-       case COMP_STOPPED:
+       case COMP_COMMAND_RING_STOPPED:
                xhci_warn(xhci, "Timeout while waiting for evaluate context command\n");
                ret = -ETIME;
                break;
@@ -3433,7 +3433,7 @@ static int xhci_discover_or_reset_device(struct usb_hcd *hcd,
        ret = reset_device_cmd->status;
        switch (ret) {
        case COMP_COMMAND_ABORTED:
-       case COMP_STOPPED:
+       case COMP_COMMAND_RING_STOPPED:
                xhci_warn(xhci, "Timeout waiting for reset device command\n");
                ret = -ETIME;
                goto command_cleanup;
@@ -3818,7 +3818,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
         */
        switch (command->status) {
        case COMP_COMMAND_ABORTED:
-       case COMP_STOPPED:
+       case COMP_COMMAND_RING_STOPPED:
                xhci_warn(xhci, "Timeout while waiting for setup device command\n");
                ret = -ETIME;
                break;