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: rename parameter to match argument 'portsc'

A previous patch renamed the temporary variable holding the value read
from the PORTSC register from 'temp' to 'portsc'. This patch follows up
by updating the parameter names of all helper functions called from
xhci_hub_control() that receive a PORTSC value, as well as the functions
they call.

Function changed:
xhci_get_port_status()
L xhci_get_usb3_port_status()
L xhci_hub_report_usb3_link_state()
L xhci_del_comp_mod_timer()
xhci_get_ext_port_status()
xhci_port_state_to_neutral()
xhci_clear_port_change_bit()
xhci_port_speed()

The reason for the rename is to differentiate between port
status/change bit to be written to PORTSC and replying to hub-class
USB requests. Each of them use their specific macros.

Use "portsc" name for PORTSC values and "status" for values intended
for replying to hub-class USB request.

A dedicated structure for USB hub port status responses
('struct usb_port_status' from ch11.h) exists and will be integrated in
a later patch.

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

authored by

Niklas Neronin and committed by
Greg Kroah-Hartman
aef5305d 58a5bfc4

+30 -31
+30 -31
drivers/usb/host/xhci-hub.c
··· 375 375 376 376 } 377 377 378 - static unsigned int xhci_port_speed(unsigned int port_status) 378 + static unsigned int xhci_port_speed(int portsc) 379 379 { 380 - if (DEV_LOWSPEED(port_status)) 380 + if (DEV_LOWSPEED(portsc)) 381 381 return USB_PORT_STAT_LOW_SPEED; 382 - if (DEV_HIGHSPEED(port_status)) 382 + if (DEV_HIGHSPEED(portsc)) 383 383 return USB_PORT_STAT_HIGH_SPEED; 384 384 /* 385 385 * FIXME: Yes, we should check for full speed, but the core uses that as ··· 429 429 430 430 /** 431 431 * xhci_port_state_to_neutral() - Clean up read portsc value back into writeable 432 - * @state: u32 port value read from portsc register to be cleanup up 432 + * @portsc: u32 port value read from portsc register to be cleanup up 433 433 * 434 - * Given a port state, this function returns a value that would result in the 434 + * Given a portsc, this function returns a value that would result in the 435 435 * port being in the same state, if the value was written to the port status 436 436 * control register. 437 437 * Save Read Only (RO) bits and save read/write bits where ··· 442 442 * changing port state. 443 443 */ 444 444 445 - u32 xhci_port_state_to_neutral(u32 state) 445 + u32 xhci_port_state_to_neutral(u32 portsc) 446 446 { 447 447 /* Save read-only status and port state */ 448 - return (state & XHCI_PORT_RO) | (state & XHCI_PORT_RWS); 448 + return (portsc & XHCI_PORT_RO) | (portsc & XHCI_PORT_RWS); 449 449 } 450 450 EXPORT_SYMBOL_GPL(xhci_port_state_to_neutral); 451 451 ··· 578 578 } 579 579 580 580 static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, struct xhci_port *port, 581 - u32 port_status) 581 + u32 portsc) 582 582 { 583 583 char *port_change_bit; 584 584 u32 status; ··· 621 621 return; 622 622 } 623 623 /* Change bits are all write 1 to clear */ 624 - xhci_portsc_writel(port, port_status | status); 625 - port_status = xhci_portsc_readl(port); 624 + xhci_portsc_writel(port, portsc | status); 625 + portsc = xhci_portsc_readl(port); 626 626 627 627 xhci_dbg(xhci, "clear port%d %s change, portsc: 0x%x\n", 628 - port->hcd_portnum + 1, port_change_bit, port_status); 628 + port->hcd_portnum + 1, port_change_bit, portsc); 629 629 } 630 630 631 631 struct xhci_hub *xhci_get_rhub(struct usb_hcd *hcd) ··· 851 851 852 852 /* Updates Link Status for super Speed port */ 853 853 static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, 854 - u32 *status, u32 status_reg) 854 + u32 *status, u32 portsc) 855 855 { 856 - u32 pls = status_reg & PORT_PLS_MASK; 856 + u32 pls = portsc & PORT_PLS_MASK; 857 857 858 858 /* When the CAS bit is set then warm reset 859 859 * should be performed on port 860 860 */ 861 - if (status_reg & PORT_CAS) { 861 + if (portsc & PORT_CAS) { 862 862 /* The CAS bit can be set while the port is 863 863 * in any link state. 864 864 * Only roothubs have CAS bit, so we ··· 910 910 * the compliance mode timer is deleted. A port won't enter 911 911 * compliance mode if it has previously entered U0. 912 912 */ 913 - static void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 status, int portnum) 913 + static void xhci_del_comp_mod_timer(struct xhci_hcd *xhci, u32 portsc, int portnum) 914 914 { 915 915 u32 all_ports_seen_u0 = ((1 << xhci->usb3_rhub.num_ports) - 1); 916 - bool port_in_u0 = ((status & PORT_PLS_MASK) == XDEV_U0); 916 + bool port_in_u0 = ((portsc & PORT_PLS_MASK) == XDEV_U0); 917 917 918 918 if (!(xhci->quirks & XHCI_COMP_MODE_QUIRK)) 919 919 return; ··· 1018 1018 return 0; 1019 1019 } 1020 1020 1021 - static u32 xhci_get_ext_port_status(u32 raw_port_status, u32 port_li) 1021 + static u32 xhci_get_ext_port_status(u32 portsc, u32 port_li) 1022 1022 { 1023 1023 u32 ext_stat = 0; 1024 1024 int speed_id; 1025 1025 1026 1026 /* only support rx and tx lane counts of 1 in usb3.1 spec */ 1027 - speed_id = DEV_PORT_SPEED(raw_port_status); 1027 + speed_id = DEV_PORT_SPEED(portsc); 1028 1028 ext_stat |= speed_id; /* bits 3:0, RX speed id */ 1029 1029 ext_stat |= speed_id << 4; /* bits 7:4, TX speed id */ 1030 1030 ··· 1150 1150 * - Drop and reacquire the xHCI lock, in order to wait for port resume. 1151 1151 */ 1152 1152 static u32 xhci_get_port_status(struct usb_hcd *hcd, struct xhci_bus_state *bus_state, 1153 - int portnum, u32 raw_port_status, unsigned long *flags) 1153 + int portnum, u32 portsc, unsigned long *flags) 1154 1154 __releases(&xhci->lock) 1155 1155 __acquires(&xhci->lock) 1156 1156 { ··· 1162 1162 port = rhub->ports[portnum]; 1163 1163 1164 1164 /* common wPortChange bits */ 1165 - if (raw_port_status & PORT_CSC) 1165 + if (portsc & PORT_CSC) 1166 1166 status |= USB_PORT_STAT_C_CONNECTION << 16; 1167 - if (raw_port_status & PORT_PEC) 1167 + if (portsc & PORT_PEC) 1168 1168 status |= USB_PORT_STAT_C_ENABLE << 16; 1169 - if ((raw_port_status & PORT_OCC)) 1169 + if (portsc & PORT_OCC) 1170 1170 status |= USB_PORT_STAT_C_OVERCURRENT << 16; 1171 - if ((raw_port_status & PORT_RC)) 1171 + if (portsc & PORT_RC) 1172 1172 status |= USB_PORT_STAT_C_RESET << 16; 1173 1173 1174 1174 /* common wPortStatus bits */ 1175 - if (raw_port_status & PORT_CONNECT) { 1175 + if (portsc & PORT_CONNECT) { 1176 1176 status |= USB_PORT_STAT_CONNECTION; 1177 - status |= xhci_port_speed(raw_port_status); 1177 + status |= xhci_port_speed(portsc); 1178 1178 } 1179 - if (raw_port_status & PORT_PE) 1179 + if (portsc & PORT_PE) 1180 1180 status |= USB_PORT_STAT_ENABLE; 1181 - if (raw_port_status & PORT_OC) 1181 + if (portsc & PORT_OC) 1182 1182 status |= USB_PORT_STAT_OVERCURRENT; 1183 - if (raw_port_status & PORT_RESET) 1183 + if (portsc & PORT_RESET) 1184 1184 status |= USB_PORT_STAT_RESET; 1185 1185 1186 1186 /* USB2 and USB3 specific bits, including Port Link State */ 1187 1187 if (hcd->speed >= HCD_USB3) 1188 - xhci_get_usb3_port_status(port, &status, raw_port_status); 1188 + xhci_get_usb3_port_status(port, &status, portsc); 1189 1189 else 1190 - xhci_get_usb2_port_status(port, &status, raw_port_status, 1191 - flags); 1190 + xhci_get_usb2_port_status(port, &status, portsc, flags); 1192 1191 1193 1192 if (bus_state->port_c_suspend & (1 << portnum)) 1194 1193 status |= USB_PORT_STAT_C_SUSPEND << 16;