Skip to content

Commit ae88758

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: remove 'handling_skipped_tds' from handle_tx_event()
When handle_tx_event() encounters a COMP_MISSED_SERVICE_ERROR or COMP_NO_PING_RESPONSE_ERROR event, it moves to 'goto cleanup'. Here, it sets a flag, 'handling_skipped_tds', based on conditions that exclude these two error events. Subsequently, the process evaluates the loop that persists as long as 'handling_skipped_tds' remains true. However, since 'trb_comp_code' does not change after its assignment, if it indicates either of the two error conditions, the loop terminates immediately. To simplify this process and enhance clarity, the modification involves returning immediately upon detecting COMP_MISSED_SERVICE_ERROR or COMP_NO_PING_RESPONSE_ERROR. This adjustment allows for the direct use of 'ep->skip', removing the necessity for the 'handling_skipped_tds' flag. Signed-off-by: Niklas Neronin <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 66cb618 commit ae88758

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,7 +2587,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
25872587
struct xhci_ep_ctx *ep_ctx;
25882588
u32 trb_comp_code;
25892589
int td_num = 0;
2590-
bool handling_skipped_tds = false;
25912590

25922591
slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
25932592
ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1;
@@ -2748,13 +2747,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
27482747
xhci_dbg(xhci,
27492748
"Miss service interval error for slot %u ep %u, set skip flag\n",
27502749
slot_id, ep_index);
2751-
goto cleanup;
2750+
return 0;
27522751
case COMP_NO_PING_RESPONSE_ERROR:
27532752
ep->skip = true;
27542753
xhci_dbg(xhci,
27552754
"No Ping response error for slot %u ep %u, Skip one Isoc TD\n",
27562755
slot_id, ep_index);
2757-
goto cleanup;
2756+
return 0;
27582757

27592758
case COMP_INCOMPATIBLE_DEVICE_ERROR:
27602759
/* needs disable slot command to recover */
@@ -2939,18 +2938,14 @@ static int handle_tx_event(struct xhci_hcd *xhci,
29392938
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
29402939
else
29412940
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
2942-
cleanup:
2943-
handling_skipped_tds = ep->skip &&
2944-
trb_comp_code != COMP_MISSED_SERVICE_ERROR &&
2945-
trb_comp_code != COMP_NO_PING_RESPONSE_ERROR;
2946-
2941+
cleanup:;
29472942
/*
29482943
* If ep->skip is set, it means there are missed tds on the
29492944
* endpoint ring need to take care of.
29502945
* Process them as short transfer until reach the td pointed by
29512946
* the event.
29522947
*/
2953-
} while (handling_skipped_tds);
2948+
} while (ep->skip);
29542949

29552950
return 0;
29562951

0 commit comments

Comments
 (0)