Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: xhci: separate use of USB Chapter 11 PLS macros from xHCI-specific PLS macros

The xhci driver uses two different sources for Port Link State (PLS):
1. The PLS field in the PORTSC register (bits 8:5).
2. The PLS value encoded in bits 15:8 of the USB request wIndex,
received by xhci_hub_control().

While both represent similar link states, they differ in a few details,
for example, xHCI's Resume State. Because of these differences, the xhci
driver defines its own set of PLS macros in xhci-port.h, which are intended
to be used when reading and writing PORTSC. The generic USB Chapter 11
macros in ch11.h should only be used when parsing or replying to hub-class
USB requests.

To avoid mixing these two representations and prevent incorrect state
reporting, replace all uses of Chapter 11 PLS macros with the xHCI
versions when interacting with the PORTSC register.

Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260402131342.2628648-18-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
4515039a 995e2af1

+7 -7
+7 -7
drivers/usb/host/xhci-hub.c
··· 866 866 * unless we're already in compliance 867 867 * or the inactive state. 868 868 */ 869 - if (pls != USB_SS_PORT_LS_COMP_MOD && 870 - pls != USB_SS_PORT_LS_SS_INACTIVE) { 869 + if (pls != XDEV_COMP_MODE && 870 + pls != XDEV_INACTIVE) { 871 871 pls = USB_SS_PORT_LS_COMP_MOD; 872 872 } 873 873 /* Return also connection bit - ··· 895 895 * caused by a delay on the host-device negotiation. 896 896 */ 897 897 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && 898 - (pls == USB_SS_PORT_LS_COMP_MOD)) 898 + (pls == XDEV_COMP_MODE)) 899 899 pls |= USB_PORT_STAT_CONNECTION; 900 900 } 901 901 ··· 1365 1365 if (link_state == USB_SS_PORT_LS_RX_DETECT) { 1366 1366 xhci_dbg(xhci, "Enable port %d-%d\n", 1367 1367 hcd->self.busnum, portnum + 1); 1368 - xhci_set_link_state(xhci, port, link_state); 1368 + xhci_set_link_state(xhci, port, XDEV_RXDETECT); 1369 1369 temp = xhci_portsc_readl(port); 1370 1370 break; 1371 1371 } ··· 1397 1397 1398 1398 xhci_dbg(xhci, "Enable compliance mode transition for port %d-%d\n", 1399 1399 hcd->self.busnum, portnum + 1); 1400 - xhci_set_link_state(xhci, port, link_state); 1400 + xhci_set_link_state(xhci, port, XDEV_COMP_MODE); 1401 1401 1402 1402 temp = xhci_portsc_readl(port); 1403 1403 break; ··· 1435 1435 reinit_completion(&port->u3exit_done); 1436 1436 } 1437 1437 if (pls <= XDEV_U3) /* U1, U2, U3 */ 1438 - xhci_set_link_state(xhci, port, USB_SS_PORT_LS_U0); 1438 + xhci_set_link_state(xhci, port, XDEV_U0); 1439 1439 if (!wait_u0) { 1440 1440 if (pls > XDEV_U3) 1441 1441 goto error; ··· 1461 1461 xhci_stop_device(xhci, port->slot_id, 1); 1462 1462 spin_lock_irqsave(&xhci->lock, flags); 1463 1463 } 1464 - xhci_set_link_state(xhci, port, USB_SS_PORT_LS_U3); 1464 + xhci_set_link_state(xhci, port, XDEV_U3); 1465 1465 spin_unlock_irqrestore(&xhci->lock, flags); 1466 1466 while (retries--) { 1467 1467 usleep_range(4000, 8000);