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: add PORTPMSC variable to xhci_hub_control()

The code handling U1/U2 timeout updates reads and modifies the PORTPMSC
register using the generic 'temp' variable, which is also used for
PORTSC. This makes the code hard to read and increases the risk of mixing
up register contents.

Introduce a dedicated 'portpmsc' variable for PORTPMSC accesses and use
it in both U1 and U2 timeout handlers. This makes the intent clearer and
keeps register operations logically separated.

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-19-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
f84965ac 4515039a

+9 -9
+9 -9
drivers/usb/host/xhci-hub.c
··· 1202 1202 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 1203 1203 int max_ports; 1204 1204 unsigned long flags; 1205 - u32 temp, status; 1205 + u32 temp, portpmsc, status; 1206 1206 int retval = 0; 1207 1207 struct xhci_bus_state *bus_state; 1208 1208 u16 link_state; ··· 1508 1508 goto error; 1509 1509 1510 1510 timeout = (wIndex & 0xff00) >> 8; 1511 - temp = readl(&port->port_reg->portpmsc); 1512 - temp &= ~PORT_U1_TIMEOUT_MASK; 1513 - temp |= PORT_U1_TIMEOUT(timeout); 1514 - writel(temp, &port->port_reg->portpmsc); 1511 + portpmsc = readl(&port->port_reg->portpmsc); 1512 + portpmsc &= ~PORT_U1_TIMEOUT_MASK; 1513 + portpmsc |= PORT_U1_TIMEOUT(timeout); 1514 + writel(portpmsc, &port->port_reg->portpmsc); 1515 1515 break; 1516 1516 case USB_PORT_FEAT_U2_TIMEOUT: 1517 1517 if (hcd->speed < HCD_USB3) 1518 1518 goto error; 1519 1519 1520 1520 timeout = (wIndex & 0xff00) >> 8; 1521 - temp = readl(&port->port_reg->portpmsc); 1522 - temp &= ~PORT_U2_TIMEOUT_MASK; 1523 - temp |= PORT_U2_TIMEOUT(timeout); 1524 - writel(temp, &port->port_reg->portpmsc); 1521 + portpmsc = readl(&port->port_reg->portpmsc); 1522 + portpmsc &= ~PORT_U2_TIMEOUT_MASK; 1523 + portpmsc |= PORT_U2_TIMEOUT(timeout); 1524 + writel(portpmsc, &port->port_reg->portpmsc); 1525 1525 break; 1526 1526 case USB_PORT_FEAT_TEST: 1527 1527 /* 4.19.6 Port Test Modes (USB2 Test Mode) */