| From 103b843025dddaf40557b50aa0c4163311765e39 Mon Sep 17 00:00:00 2001 |
| From: Lu Baolu <baolu.lu@linux.intel.com> |
| Date: Mon, 23 Jan 2017 14:20:02 +0200 |
| Subject: [PATCH 191/255] usb: xhci: use list_is_singular for cmd_list |
| |
| Use list_is_singular() to check if cmd_list has only one entry. |
| |
| [use list_empty() in queue command instead -Mathias] |
| Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> |
| Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| |
| (cherry picked from commit daa47f2132dce31fcab7c6ebdcb957e598c768f2) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/usb/host/xhci-ring.c | 7 ++++--- |
| 1 file changed, 4 insertions(+), 3 deletions(-) |
| |
| --- a/drivers/usb/host/xhci-ring.c |
| +++ b/drivers/usb/host/xhci-ring.c |
| @@ -1428,7 +1428,7 @@ static void handle_cmd_completion(struct |
| } |
| |
| /* restart timer if this wasn't the last command */ |
| - if (cmd->cmd_list.next != &xhci->cmd_list) { |
| + if (!list_is_singular(&xhci->cmd_list)) { |
| xhci->current_cmd = list_entry(cmd->cmd_list.next, |
| struct xhci_command, cmd_list); |
| xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); |
| @@ -3805,14 +3805,15 @@ static int queue_command(struct xhci_hcd |
| } |
| |
| cmd->command_trb = xhci->cmd_ring->enqueue; |
| - list_add_tail(&cmd->cmd_list, &xhci->cmd_list); |
| |
| /* if there are no other commands queued we start the timeout timer */ |
| - if (xhci->cmd_list.next == &cmd->cmd_list) { |
| + if (list_empty(&xhci->cmd_list)) { |
| xhci->current_cmd = cmd; |
| xhci_mod_cmd_timer(xhci, XHCI_CMD_DEFAULT_TIMEOUT); |
| } |
| |
| + list_add_tail(&cmd->cmd_list, &xhci->cmd_list); |
| + |
| queue_trb(xhci, xhci->cmd_ring, false, field1, field2, field3, |
| field4 | xhci->cmd_ring->cycle_state); |
| return 0; |