Skip to content

Commit d0a0fa9

Browse files
matnymangregkh
authored andcommitted
xhci: Add option to get next extended capability in list by passing id = 0
Modify xhci_find_next_ext_cap(base, offset, id) to return the next capability offset if 0 is passed for id. Otherwise it will behave as previously and return the offset of the next capability with matching id capability id 0 is not used by xHCI (reserved) This is useful when we want to loop through all capabilities. Signed-off-by: Mathias Nyman <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Heikki Krogerus <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2000016 commit d0a0fa9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/usb/host/xhci-ext-caps.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
* @base PCI MMIO registers base address.
8585
* @start address at which to start looking, (0 or HCC_PARAMS to start at
8686
* beginning of list)
87-
* @id Extended capability ID to search for.
87+
* @id Extended capability ID to search for, or 0 for the next
88+
* capability
8889
*
8990
* Returns the offset of the next matching extended capability structure.
9091
* Some capabilities can occur several times, e.g., the XHCI_EXT_CAPS_PROTOCOL,
@@ -110,7 +111,7 @@ static inline int xhci_find_next_ext_cap(void __iomem *base, u32 start, int id)
110111
val = readl(base + offset);
111112
if (val == ~0)
112113
return 0;
113-
if (XHCI_EXT_CAPS_ID(val) == id && offset != start)
114+
if (offset != start && (id == 0 || XHCI_EXT_CAPS_ID(val) == id))
114115
return offset;
115116

116117
next = XHCI_EXT_CAPS_NEXT(val);

0 commit comments

Comments
 (0)