]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xhci: simplify and rework trb_in_td()
authorMathias Nyman <mathias.nyman@linux.intel.com>
Wed, 19 Nov 2025 14:23:57 +0000 (16:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 13:52:59 +0000 (14:52 +0100)
commit86dcf43be869fe683923f577ddc3d04ec37ff581
tree2e2a2b567301ff2907853e8262cc3c8f4fe0795e
parentfad902d6709e349babe8fc79550552512facac30
xhci: simplify and rework trb_in_td()

The trb_in_td() checking is quite complex, especially when checking for
TRBs in ranges that can span several segments.

Simplify the search by creating a position index for each TRB on the
ring, and just compare the position indexes.
Add a more generic dma_in_range() helper that checks if a trb dma
address is in the range between a start and end trb and call it from
trb_in_td()

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20251119142417.2820519-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c