]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xhci: use the trb_to_noop() helper for command trbs
authorMathias Nyman <mathias.nyman@linux.intel.com>
Mon, 23 Jan 2017 12:20:16 +0000 (14:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Jan 2017 09:59:07 +0000 (10:59 +0100)
Remove duplicate code by using trb_to_noop() when
handling Aborted commads

Based on earlier code by Felipe Balbi <felipe.balbi@linux.intel.com>

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c

index bd00ada6643bb72df35c9ae5b9d14e0b44d28b4e..92715b954d8626b71c0395ca205f0e8a8596a42e 100644 (file)
@@ -314,7 +314,6 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
                                         struct xhci_command *cur_cmd)
 {
        struct xhci_command *i_cmd;
-       u32 cycle_state;
 
        /* Turn all aborted commands in list to no-ops, then restart */
        list_for_each_entry(i_cmd, &xhci->cmd_list, cmd_list) {
@@ -326,15 +325,8 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci,
 
                xhci_dbg(xhci, "Turn aborted command %p to no-op\n",
                         i_cmd->command_trb);
-               /* get cycle state from the original cmd trb */
-               cycle_state = le32_to_cpu(
-                       i_cmd->command_trb->generic.field[3]) & TRB_CYCLE;
-               /* modify the command trb to no-op command */
-               i_cmd->command_trb->generic.field[0] = 0;
-               i_cmd->command_trb->generic.field[1] = 0;
-               i_cmd->command_trb->generic.field[2] = 0;
-               i_cmd->command_trb->generic.field[3] = cpu_to_le32(
-                       TRB_TYPE(TRB_CMD_NOOP) | cycle_state);
+
+               trb_to_noop(i_cmd->command_trb, TRB_CMD_NOOP);
 
                /*
                 * caller waiting for completion is called when command