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

USB: Remove bogus USB_PORT_STAT_SUPER_SPEED symbol.

USB_PORT_STAT_SUPER_SPEED is a made up symbol that the USB core used to
track whether USB ports had a SuperSpeed device attached. This is a
linux-internal symbol that was used when SuperSpeed and non-SuperSpeed
devices would show up under the same xHCI roothub. This particular
port status is never returned by external USB 3.0 hubs. (Instead they
have a USB_PORT_STAT_SPEED_5GBPS that uses a completely different speed
mask.)

Now that the xHCI driver registers two roothubs, USB 3.0 devices will only
show up under USB 3.0 hubs. Rip out USB_PORT_STAT_SUPER_SPEED and replace
it with calls to hub_is_superspeed().

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>

+8 -31
+8 -28
drivers/usb/core/hub.c
··· 155 155 156 156 static int usb_reset_and_verify_device(struct usb_device *udev); 157 157 158 - static inline char *portspeed(int portstatus) 158 + static inline char *portspeed(struct usb_hub *hub, int portstatus) 159 159 { 160 + if (hub_is_superspeed(hub->hdev)) 161 + return "5.0 Gb/s"; 160 162 if (portstatus & USB_PORT_STAT_HIGH_SPEED) 161 163 return "480 Mb/s"; 162 164 else if (portstatus & USB_PORT_STAT_LOW_SPEED) 163 165 return "1.5 Mb/s"; 164 - else if (portstatus & USB_PORT_STAT_SUPER_SPEED) 165 - return "5.0 Gb/s"; 166 166 else 167 167 return "12 Mb/s"; 168 168 } ··· 385 385 u16 tmp = *status & USB_SS_PORT_STAT_MASK; 386 386 if (*status & USB_SS_PORT_STAT_POWER) 387 387 tmp |= USB_PORT_STAT_POWER; 388 - if ((*status & USB_SS_PORT_STAT_SPEED) == 389 - USB_PORT_STAT_SPEED_5GBPS) 390 - tmp |= USB_PORT_STAT_SUPER_SPEED; 391 388 *status = tmp; 392 389 } 393 390 ··· 792 795 * USB3 protocol ports will automatically transition 793 796 * to Enabled state when detect an USB3.0 device attach. 794 797 * Do not disable USB3 protocol ports. 795 - * FIXME: USB3 root hub and external hubs are treated 796 - * differently here. 797 798 */ 798 - if (hdev->descriptor.bDeviceProtocol != 3 || 799 - (!hdev->parent && 800 - !(portstatus & USB_PORT_STAT_SUPER_SPEED))) { 799 + if (!hub_is_superspeed(hdev)) { 801 800 clear_port_feature(hdev, port1, 802 801 USB_PORT_FEAT_ENABLE); 803 802 portstatus &= ~USB_PORT_STAT_ENABLE; ··· 2060 2067 (portstatus & USB_PORT_STAT_ENABLE)) { 2061 2068 if (hub_is_wusb(hub)) 2062 2069 udev->speed = USB_SPEED_WIRELESS; 2063 - else if (portstatus & USB_PORT_STAT_SUPER_SPEED) 2070 + else if (hub_is_superspeed(hub->hdev)) 2064 2071 udev->speed = USB_SPEED_SUPER; 2065 2072 else if (portstatus & USB_PORT_STAT_HIGH_SPEED) 2066 2073 udev->speed = USB_SPEED_HIGH; 2067 2074 else if (portstatus & USB_PORT_STAT_LOW_SPEED) 2068 2075 udev->speed = USB_SPEED_LOW; 2069 - else if (portstatus & USB_PORT_STAT_SUPER_SPEED) 2070 - udev->speed = USB_SPEED_SUPER; 2071 2076 else 2072 2077 udev->speed = USB_SPEED_FULL; 2073 2078 return 0; ··· 3058 3067 3059 3068 dev_dbg (hub_dev, 3060 3069 "port %d, status %04x, change %04x, %s\n", 3061 - port1, portstatus, portchange, portspeed (portstatus)); 3070 + port1, portstatus, portchange, portspeed(hub, portstatus)); 3062 3071 3063 3072 if (hub->has_indicators) { 3064 3073 set_port_led(hub, port1, HUB_LED_AUTO); ··· 3159 3168 udev->level = hdev->level + 1; 3160 3169 udev->wusb = hub_is_wusb(hub); 3161 3170 3162 - /* 3163 - * USB 3.0 devices are reset automatically before the connect 3164 - * port status change appears, and the root hub port status 3165 - * shows the correct speed. We also get port change 3166 - * notifications for USB 3.0 devices from the USB 3.0 portion of 3167 - * an external USB 3.0 hub, but this isn't handled correctly yet 3168 - * FIXME. 3169 - */ 3170 - 3171 - if (!(hcd->driver->flags & HCD_USB3)) 3172 - udev->speed = USB_SPEED_UNKNOWN; 3173 - else if ((hdev->parent == NULL) && 3174 - (portstatus & USB_PORT_STAT_SUPER_SPEED)) 3171 + /* Only USB 3.0 devices are connected to SuperSpeed hubs. */ 3172 + if (hub_is_superspeed(hub->hdev)) 3175 3173 udev->speed = USB_SPEED_SUPER; 3176 3174 else 3177 3175 udev->speed = USB_SPEED_UNKNOWN;
-2
drivers/usb/host/xhci-hub.c
··· 155 155 return USB_PORT_STAT_LOW_SPEED; 156 156 if (DEV_HIGHSPEED(port_status)) 157 157 return USB_PORT_STAT_HIGH_SPEED; 158 - if (DEV_SUPERSPEED(port_status)) 159 - return USB_PORT_STAT_SUPER_SPEED; 160 158 /* 161 159 * FIXME: Yes, we should check for full speed, but the core uses that as 162 160 * a default in portspeed() in usb/core/hub.c (which is the only place
-1
include/linux/usb/ch11.h
··· 109 109 #define USB_PORT_STAT_TEST 0x0800 110 110 #define USB_PORT_STAT_INDICATOR 0x1000 111 111 /* bits 13 to 15 are reserved */ 112 - #define USB_PORT_STAT_SUPER_SPEED 0x8000 /* Linux-internal */ 113 112 114 113 /* 115 114 * Additions to wPortStatus bit field from USB 3.0