Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 131dec34 authored by Sarah Sharp's avatar Sarah Sharp
Browse files

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: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
parent c6cc27c7
Loading
Loading
Loading
Loading
+8 −28
Original line number Diff line number Diff line
@@ -155,14 +155,14 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);

static int usb_reset_and_verify_device(struct usb_device *udev);

static inline char *portspeed(int portstatus)
static inline char *portspeed(struct usb_hub *hub, int portstatus)
{
	if (hub_is_superspeed(hub->hdev))
		return "5.0 Gb/s";
	if (portstatus & USB_PORT_STAT_HIGH_SPEED)
    		return "480 Mb/s";
	else if (portstatus & USB_PORT_STAT_LOW_SPEED)
		return "1.5 Mb/s";
	else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
		return "5.0 Gb/s";
	else
		return "12 Mb/s";
}
@@ -385,9 +385,6 @@ static int hub_port_status(struct usb_hub *hub, int port1,
			u16 tmp = *status & USB_SS_PORT_STAT_MASK;
			if (*status & USB_SS_PORT_STAT_POWER)
				tmp |= USB_PORT_STAT_POWER;
			if ((*status & USB_SS_PORT_STAT_SPEED) ==
					USB_PORT_STAT_SPEED_5GBPS)
				tmp |= USB_PORT_STAT_SUPER_SPEED;
			*status = tmp;
		}

@@ -795,12 +792,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
			 * USB3 protocol ports will automatically transition
			 * to Enabled state when detect an USB3.0 device attach.
			 * Do not disable USB3 protocol ports.
			 * FIXME: USB3 root hub and external hubs are treated
			 * differently here.
			 */
			if (hdev->descriptor.bDeviceProtocol != 3 ||
			    (!hdev->parent &&
			     !(portstatus & USB_PORT_STAT_SUPER_SPEED))) {
			if (!hub_is_superspeed(hdev)) {
				clear_port_feature(hdev, port1,
						   USB_PORT_FEAT_ENABLE);
				portstatus &= ~USB_PORT_STAT_ENABLE;
@@ -2067,14 +2060,12 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
		    (portstatus & USB_PORT_STAT_ENABLE)) {
			if (hub_is_wusb(hub))
				udev->speed = USB_SPEED_WIRELESS;
			else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
			else if (hub_is_superspeed(hub->hdev))
				udev->speed = USB_SPEED_SUPER;
			else if (portstatus & USB_PORT_STAT_HIGH_SPEED)
				udev->speed = USB_SPEED_HIGH;
			else if (portstatus & USB_PORT_STAT_LOW_SPEED)
				udev->speed = USB_SPEED_LOW;
			else if (portstatus & USB_PORT_STAT_SUPER_SPEED)
				udev->speed = USB_SPEED_SUPER;
			else
				udev->speed = USB_SPEED_FULL;
			return 0;
@@ -3067,7 +3058,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,

	dev_dbg (hub_dev,
		"port %d, status %04x, change %04x, %s\n",
		port1, portstatus, portchange, portspeed (portstatus));
		port1, portstatus, portchange, portspeed(hub, portstatus));

	if (hub->has_indicators) {
		set_port_led(hub, port1, HUB_LED_AUTO);
@@ -3168,19 +3159,8 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
		udev->level = hdev->level + 1;
		udev->wusb = hub_is_wusb(hub);

		/*
		 * USB 3.0 devices are reset automatically before the connect
		 * port status change appears, and the root hub port status
		 * shows the correct speed.  We also get port change
		 * notifications for USB 3.0 devices from the USB 3.0 portion of
		 * an external USB 3.0 hub, but this isn't handled correctly yet
		 * FIXME.
		 */

		if (!(hcd->driver->flags & HCD_USB3))
			udev->speed = USB_SPEED_UNKNOWN;
		else if ((hdev->parent == NULL) &&
				(portstatus & USB_PORT_STAT_SUPER_SPEED))
		/* Only USB 3.0 devices are connected to SuperSpeed hubs. */
		if (hub_is_superspeed(hub->hdev))
			udev->speed = USB_SPEED_SUPER;
		else
			udev->speed = USB_SPEED_UNKNOWN;
+0 −2
Original line number Diff line number Diff line
@@ -155,8 +155,6 @@ static unsigned int xhci_port_speed(unsigned int port_status)
		return USB_PORT_STAT_LOW_SPEED;
	if (DEV_HIGHSPEED(port_status))
		return USB_PORT_STAT_HIGH_SPEED;
	if (DEV_SUPERSPEED(port_status))
		return USB_PORT_STAT_SUPER_SPEED;
	/*
	 * FIXME: Yes, we should check for full speed, but the core uses that as
	 * a default in portspeed() in usb/core/hub.c (which is the only place
+0 −1
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ struct usb_port_status {
#define USB_PORT_STAT_TEST              0x0800
#define USB_PORT_STAT_INDICATOR         0x1000
/* bits 13 to 15 are reserved */
#define USB_PORT_STAT_SUPER_SPEED	0x8000	/* Linux-internal */

/*
 * Additions to wPortStatus bit field from USB 3.0