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.

xhci: refactor U0 link state handling in get_port_status

Move U0 link state handing to USB3 and USB2 specific functions

Note that
bus_state->resuming_ports:
bus_state->resume_done[]:
are only used for USB2, and don't need to cleared for USB3 ports

No functional changes

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathias Nyman and committed by
Greg Kroah-Hartman
a231ec41 3c2ddb44

+19 -13
+19 -13
drivers/usb/host/xhci-hub.c
··· 814 814 static void xhci_get_usb3_port_status(struct xhci_port *port, u32 *status, 815 815 u32 portsc) 816 816 { 817 + struct xhci_bus_state *bus_state; 817 818 struct xhci_hcd *xhci; 818 819 u32 link_state; 819 820 u32 portnum; 820 821 822 + bus_state = &port->rhub->bus_state; 821 823 xhci = hcd_to_xhci(port->rhub->hcd); 822 824 link_state = portsc & PORT_PLS_MASK; 823 825 portnum = port->hcd_portnum; ··· 841 839 *status |= USB_PORT_STAT_C_CONFIG_ERROR << 16; 842 840 843 841 /* USB3 specific wPortStatus bits */ 844 - if (portsc & PORT_POWER) 842 + if (portsc & PORT_POWER) { 845 843 *status |= USB_SS_PORT_STAT_POWER; 844 + /* link state handling */ 845 + if (link_state == XDEV_U0) 846 + bus_state->suspended_ports &= ~(1 << portnum); 847 + } 846 848 847 849 xhci_hub_report_usb3_link_state(xhci, status, portsc); 848 850 xhci_del_comp_mod_timer(xhci, portsc, portnum); ··· 855 849 static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status, 856 850 u32 portsc) 857 851 { 852 + struct xhci_bus_state *bus_state; 858 853 u32 link_state; 854 + u32 portnum; 859 855 856 + bus_state = &port->rhub->bus_state; 860 857 link_state = portsc & PORT_PLS_MASK; 858 + portnum = port->hcd_portnum; 861 859 862 860 /* USB2 wPortStatus bits */ 863 861 if (portsc & PORT_POWER) { ··· 872 862 *status |= USB_PORT_STAT_SUSPEND; 873 863 if (link_state == XDEV_U2) 874 864 *status |= USB_PORT_STAT_L1; 865 + if (link_state == XDEV_U0) { 866 + bus_state->resume_done[portnum] = 0; 867 + clear_bit(portnum, &bus_state->resuming_ports); 868 + if (bus_state->suspended_ports & (1 << portnum)) { 869 + bus_state->suspended_ports &= ~(1 << portnum); 870 + bus_state->port_c_suspend |= 1 << portnum; 871 + } 872 + } 875 873 } 876 874 } 877 875 ··· 1027 1009 bus_state->resume_done[wIndex] = 0; 1028 1010 clear_bit(wIndex, &bus_state->resuming_ports); 1029 1011 usb_hcd_end_port_resume(&hcd->self, wIndex); 1030 - } 1031 - 1032 - 1033 - if ((raw_port_status & PORT_PLS_MASK) == XDEV_U0 && 1034 - (raw_port_status & PORT_POWER)) { 1035 - if (bus_state->suspended_ports & (1 << wIndex)) { 1036 - bus_state->suspended_ports &= ~(1 << wIndex); 1037 - if (hcd->speed < HCD_USB3) 1038 - bus_state->port_c_suspend |= 1 << wIndex; 1039 - } 1040 - bus_state->resume_done[wIndex] = 0; 1041 - clear_bit(wIndex, &bus_state->resuming_ports); 1042 1012 } 1043 1013 1044 1014 if (bus_state->port_c_suspend & (1 << wIndex))