usb: xhci: utilize 'xhci_free_segments_for_ring()' for freeing segments
authorNiklas Neronin <niklas.neronin@linux.intel.com>
Thu, 29 Feb 2024 14:14:34 +0000 (16:14 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 Mar 2024 19:25:27 +0000 (20:25 +0100)
commit2e8dd2ded2a18c9ef83ad1c84547948fc64b6155
treeab6835dbafde8ccb42e494af6b696f9c1a1c9f9c
parent00bdc4a34b2885f54468d4bdbb56d4055ce20ac9
usb: xhci: utilize 'xhci_free_segments_for_ring()' for freeing segments

Refactor the code to improve readability by using
'xhci_free_segments_for_ring()' function for freeing ring segments.
This replaces the custom while loop previously used within
'xhci_ring_expansion()' and 'xhci_alloc_segments_for_ring()'.

Slightly modify 'xhci_free_segments_for_ring()' to handle lists
which do not loop. This makes it possible to use it in error
paths of 'xhci_alloc_segments_for_ring()'.

This change also prepares for switching the custom xhci linked segment
list into to more standard list.h lists.

[minor commit message rewording -Mathias]

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/20240229141438.619372-6-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-mem.c