Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: xhci: adjust empty TD list handling in handle_tx_event()

Introduce an initial check for an empty list prior to entering the while
loop. Which enables, the implementation of distinct warnings to
differentiate between scenarios where the list is initially empty and
when it has been emptied during processing skipped isoc TDs.

These adjustments not only simplifies the large while loop, but also
facilitates future enhancements to the handle_tx_event() function.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240905143300.1959279-11-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
da6a6dcf dbb2c922

+24 -27
+24 -27
drivers/usb/host/xhci-ring.c
··· 2761 2761 return 0; 2762 2762 } 2763 2763 2764 - do { 2765 - /* This TRB should be in the TD at the head of this ring's 2766 - * TD list. 2764 + if (list_empty(&ep_ring->td_list)) { 2765 + /* 2766 + * Don't print wanings if ring is empty due to a stopped endpoint generating an 2767 + * extra completion event if the device was suspended. Or, a event for the last TRB 2768 + * of a short TD we already got a short event for. The short TD is already removed 2769 + * from the TD list. 2767 2770 */ 2768 - if (list_empty(&ep_ring->td_list)) { 2769 - /* 2770 - * Don't print wanings if it's due to a stopped endpoint 2771 - * generating an extra completion event if the device 2772 - * was suspended. Or, a event for the last TRB of a 2773 - * short TD we already got a short event for. 2774 - * The short TD is already removed from the TD list. 2775 - */ 2776 - 2777 - if (!(trb_comp_code == COMP_STOPPED || 2778 - trb_comp_code == COMP_STOPPED_LENGTH_INVALID || 2779 - ep_ring->last_td_was_short)) { 2780 - xhci_warn(xhci, "WARN Event TRB for slot %u ep %d with no TDs queued?\n", 2781 - slot_id, ep_index); 2782 - } 2783 - if (ep->skip) { 2784 - ep->skip = false; 2785 - xhci_dbg(xhci, "td_list is empty while skip flag set. Clear skip flag for slot %u ep %u.\n", 2786 - slot_id, ep_index); 2787 - } 2788 - 2789 - td = NULL; 2790 - goto check_endpoint_halted; 2771 + if (trb_comp_code != COMP_STOPPED && 2772 + trb_comp_code != COMP_STOPPED_LENGTH_INVALID && 2773 + !ep_ring->last_td_was_short) { 2774 + xhci_warn(xhci, "Event TRB for slot %u ep %u with no TDs queued\n", 2775 + slot_id, ep_index); 2791 2776 } 2792 2777 2778 + ep->skip = false; 2779 + goto check_endpoint_halted; 2780 + } 2781 + 2782 + do { 2793 2783 td = list_first_entry(&ep_ring->td_list, struct xhci_td, 2794 2784 td_list); 2795 2785 ··· 2790 2800 2791 2801 if (ep->skip && usb_endpoint_xfer_isoc(&td->urb->ep->desc)) { 2792 2802 skip_isoc_td(xhci, td, ep, status); 2793 - continue; 2803 + if (!list_empty(&ep_ring->td_list)) 2804 + continue; 2805 + 2806 + xhci_dbg(xhci, "All TDs skipped for slot %u ep %u. Clear skip flag.\n", 2807 + slot_id, ep_index); 2808 + ep->skip = false; 2809 + td = NULL; 2810 + goto check_endpoint_halted; 2794 2811 } 2795 2812 2796 2813 /*