Re: [PATCH 1/3] usb: xhci: Simplify update_ring_for_set_deq_completion()

From: Mathias Nyman
Date: Fri Feb 21 2025 - 08:27:31 EST


On 21.2.2025 0.44, Michal Pecio wrote:
This function checks if the queued Set Deq pointer really belongs to the
ring it was queued on and updates the ring's dequeue state. It also used
to count free TRBs, but that part has been removed.

The code is needlessly complex and inefficent, walking TRBs one by one.
And it could "jump off the segment into la-la-land" if a segment doesn't
end with a link TRB or if the link points to another link.

Make if faster, simpler and more robust. Upgrade xhci_dbg() to xhci_err()
because this situation is a bug and shouldn't happen.

Signed-off-by: Michal Pecio <michal.pecio@xxxxxxxxx>


update_ring_for_set_deq_completion() isn't needed anymore.
Niklas already wrote a patch to remove it.

It's sitting in my for-usb-next branch

https://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git/commit/?h=for-usb-next&id=ee7dab196a7dfc48a1608274329323cb10b4340d

Thanks
Mathias