Re: [PATCH 22/25] usb: host: xhci: remove unnecessary list_for_each_entry_safe()
Hi Felipe, On 2 December 2016 at 18:15, Sergei Shtylyovwrote: > Hello! > > On 12/1/2016 4:31 PM, Felipe Balbi wrote: > >> the _save() version of list iterators are supposed to be used when > > >_safe(). > >> list_entry is going to be removed from the list while iterating. Since >> xhci_handle_stopped_cmd_ring() is not removing anything from the list, >> just converting commands into No-Op TRBs, we don't need to use the safe >> version. >> >> Signed-off-by: Felipe Balbi >> --- >> drivers/usb/host/xhci-ring.c | 21 ++--- >> 1 file changed, 10 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c >> index 50244dee6b43..ebb52ffab805 100644 >> --- a/drivers/usb/host/xhci-ring.c >> +++ b/drivers/usb/host/xhci-ring.c > > [...] >> >> @@ -1250,7 +1250,6 @@ static void xhci_handle_stopped_cmd_ring(struct >> xhci_hcd *xhci, >> mod_timer(>cmd_timer, jiffies + >> XHCI_CMD_DEFAULT_TIMEOUT); >> xhci_ring_cmd_db(xhci); >> } >> - return; > > >Not mentioned in the patch description? Just a note, this has been fixed by my previous patch: https://lkml.org/lkml/2016/11/24/219 -- Baolin.wang Best Regards -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 22/25] usb: host: xhci: remove unnecessary list_for_each_entry_safe()
Hello! On 12/1/2016 4:31 PM, Felipe Balbi wrote: the _save() version of list iterators are supposed to be used when _safe(). list_entry is going to be removed from the list while iterating. Since xhci_handle_stopped_cmd_ring() is not removing anything from the list, just converting commands into No-Op TRBs, we don't need to use the safe version. Signed-off-by: Felipe Balbi--- drivers/usb/host/xhci-ring.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 50244dee6b43..ebb52ffab805 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c [...] @@ -1250,7 +1250,6 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, mod_timer(>cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); xhci_ring_cmd_db(xhci); } - return; Not mentioned in the patch description? } MBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 22/25] usb: host: xhci: remove unnecessary list_for_each_entry_safe()
the _save() version of list iterators are supposed to be used when list_entry is going to be removed from the list while iterating. Since xhci_handle_stopped_cmd_ring() is not removing anything from the list, just converting commands into No-Op TRBs, we don't need to use the safe version. Signed-off-by: Felipe Balbi--- drivers/usb/host/xhci-ring.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 50244dee6b43..ebb52ffab805 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -1211,28 +1211,28 @@ void xhci_cleanup_command_queue(struct xhci_hcd *xhci) static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, struct xhci_command *cur_cmd) { - struct xhci_command *i_cmd, *tmp_cmd; + struct xhci_command *cmd; u32 cycle_state; /* Turn all aborted commands in list to no-ops, then restart */ - list_for_each_entry_safe(i_cmd, tmp_cmd, >cmd_list, + list_for_each_entry(cmd, >cmd_list, cmd_list) { - if (i_cmd->status != COMP_COMMAND_ABORTED) + if (cmd->status != COMP_COMMAND_ABORTED) continue; - i_cmd->status = COMP_STOPPED; + cmd->status = COMP_STOPPED; xhci_dbg(xhci, "Turn aborted command %p to no-op\n", -i_cmd->command_trb); +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; + 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( + cmd->command_trb->generic.field[0] = 0; + cmd->command_trb->generic.field[1] = 0; + cmd->command_trb->generic.field[2] = 0; + cmd->command_trb->generic.field[3] = cpu_to_le32( TRB_TYPE(TRB_CMD_NOOP) | cycle_state); /* @@ -1250,7 +1250,6 @@ static void xhci_handle_stopped_cmd_ring(struct xhci_hcd *xhci, mod_timer(>cmd_timer, jiffies + XHCI_CMD_DEFAULT_TIMEOUT); xhci_ring_cmd_db(xhci); } - return; } -- 2.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html