Re: [PATCH 2/6] usb: xhci: Deduplicate some endpoint state flag lists
From: Michał Pecio
Date: Mon Mar 10 2025 - 20:13:30 EST
On Mon, 10 Mar 2025 11:51:30 +0200, Mathias Nyman wrote:
> Not sure this helps readability
>
> It defines even more macros to abstract away something that is not
> complex enough.
It was less about readability, but keeping these lists in one place
so that they don't get out of sync and trigger the double-stop bug.
With this change, a new flag like EP_STALLED only needs to be added
in one place and it's picked up by both functions which need it.
OTOH, maybe such flags aren't being added very often...
> It also gives false impression that EP_HALTED would somehow be more
> part of cancelling a TD than EP_STALLED, when both of those are about
> returning a TD with an error due to transfer issues detected by host,
> not class driver cancelling URBs.
I think EP_HALTED is about cancellation (among other things), because
it indicates that Reset EP handler will run and finish cancellation of
the halted TD and also any other TDs unlinked by class driver.
EP_STALLED and EP_CLEARING_TT are less about the halted TD and more
about ensuring full reset of the pipe before new TDs are executed.
Michal