Skip to contentSkip to conversation

usb: always print reset/new device message

PATCH In review nick black 2 participants 2 messages Mar 21, 2024 – Mar 23, 2024 USB

lore
Share & tools
lore

nick black

author
#0 lore raw

PATCH 1/1 usb: always print reset/new device message

Since usb_speed_string() always returns a valid string (invalid speeds turn into "UNKNOWN"), go ahead and always print this diagnostic, rather than checking the speed here (which wasn't up to date for SPEED_SUPER_PLUS, and looks like it had an off-by-one error anyway).

---
 drivers/usb/core/hub.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/usb/core/hub.c +4 -5
index e38a4124f610..7325e5420900 100644
@@ -4909,11 +4909,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
 	else
 		driver_name = udev->bus->sysdev->driver->name;
 
-	if (udev->speed < USB_SPEED_SUPER)
-		dev_info(&udev->dev,
-				"%s %s USB device number %d using %s\n",
-				(initial ? "new" : "reset"), speed,
-				devnum, driver_name);
+	dev_info(&udev->dev,
+			"%s %s USB device number %d using %s\n",
+			(initial ? "new" : "reset"), speed,
+			devnum, driver_name);
 
 	if (initial) {
 		/* Set up TT records, if needed  */
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · nick black

Since usb_speed_string() always returns a valid string (invalid speeds turn into "UNKNOWN"), go ahead and always print this diagnostic, rather than checking the speed here (which wasn't up to date for SPEED_SUPER_PLUS, and looks like it had an off-by-one error anyway).

This change isn't needed. For speeds >= SPEED_SUPER, the corresponding information is printed in the vicinity of line 5027.

Alan Stern

Quoted 28 lines
---
 drivers/usb/core/hub.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/usb/core/hub.c +4 -5
index e38a4124f610..7325e5420900 100644
@@ -4909,11 +4909,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
 	else
 		driver_name = udev->bus->sysdev->driver->name;
 
-	if (udev->speed < USB_SPEED_SUPER)
-		dev_info(&udev->dev,
-				"%s %s USB device number %d using %s\n",
-				(initial ? "new" : "reset"), speed,
-				devnum, driver_name);
+	dev_info(&udev->dev,
+			"%s %s USB device number %d using %s\n",
+			(initial ? "new" : "reset"), speed,
+			devnum, driver_name);
 
 	if (initial) {
 		/* Set up TT records, if needed  */
Signature · 1 line
2.43.0