Commit ae887586 authored by Niklas Neronin's avatar Niklas Neronin Committed by Greg Kroah-Hartman

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: default avatarNiklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240429140245.3955523-12-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 66cb618b
...@@ -2587,7 +2587,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2587,7 +2587,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
struct xhci_ep_ctx *ep_ctx; struct xhci_ep_ctx *ep_ctx;
u32 trb_comp_code; u32 trb_comp_code;
int td_num = 0; int td_num = 0;
bool handling_skipped_tds = false;
slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags)); slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1; 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, ...@@ -2748,13 +2747,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
xhci_dbg(xhci, xhci_dbg(xhci,
"Miss service interval error for slot %u ep %u, set skip flag\n", "Miss service interval error for slot %u ep %u, set skip flag\n",
slot_id, ep_index); slot_id, ep_index);
goto cleanup; return 0;
case COMP_NO_PING_RESPONSE_ERROR: case COMP_NO_PING_RESPONSE_ERROR:
ep->skip = true; ep->skip = true;
xhci_dbg(xhci, xhci_dbg(xhci,
"No Ping response error for slot %u ep %u, Skip one Isoc TD\n", "No Ping response error for slot %u ep %u, Skip one Isoc TD\n",
slot_id, ep_index); slot_id, ep_index);
goto cleanup; return 0;
case COMP_INCOMPATIBLE_DEVICE_ERROR: case COMP_INCOMPATIBLE_DEVICE_ERROR:
/* needs disable slot command to recover */ /* needs disable slot command to recover */
...@@ -2939,18 +2938,14 @@ static int handle_tx_event(struct xhci_hcd *xhci, ...@@ -2939,18 +2938,14 @@ static int handle_tx_event(struct xhci_hcd *xhci,
process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event); process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event);
else else
process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event); process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event);
cleanup: cleanup:;
handling_skipped_tds = ep->skip &&
trb_comp_code != COMP_MISSED_SERVICE_ERROR &&
trb_comp_code != COMP_NO_PING_RESPONSE_ERROR;
/* /*
* If ep->skip is set, it means there are missed tds on the * If ep->skip is set, it means there are missed tds on the
* endpoint ring need to take care of. * endpoint ring need to take care of.
* Process them as short transfer until reach the td pointed by * Process them as short transfer until reach the td pointed by
* the event. * the event.
*/ */
} while (handling_skipped_tds); } while (ep->skip);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment