Skip to contentSkip to conversation

usb: host: Print device name when scanning

PATCH Superseded Ismael Luceno Cortes 2 participants 4 messages Mar 18, 2019 – Mar 19, 2019 USB

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 usb: host: Print device name when scanning

Drop the counter, it has no meaning other than being the order in which the interface is found; the name assigned to the USB host controller interface is a better indicator.

Example of the original output:

Quoted 3 lines

USB0: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found

Patched output:

Quoted 3 lines

Bus usb at ee080100: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found

---

Notes:
Changes since v2:
- Dropped counter altogether.

Changes since v1:
- Improved commit message.

 drivers/usb/host/usb-uclass.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/usb/host/usb-uclass.c +3 -7
index 611ea97a72..a7179abc3a 100644
@@ -242,7 +242,6 @@ int usb_init(void)
 	struct usb_bus_priv *priv;
 	struct udevice *bus;
 	struct uclass *uc;
-	int count = 0;
 	int ret;
 
 	asynch_allowed = 1;
@@ -255,8 +254,7 @@ int usb_init(void)
 
 	uclass_foreach_dev(bus, uc) {
 		/* init low_level USB */
-		printf("USB%d:   ", count);
-		count++;
+		printf("Bus %s:   ", bus->name);
 
 #ifdef CONFIG_SANDBOX
 		/*
@@ -327,10 +325,8 @@ int usb_init(void)
 	remove_inactive_children(uc, bus);
 
 	/* if we were not able to find at least one working bus, bail out */
-	if (!count)
-		printf("No controllers found\n");
-	else if (controllers_initialized == 0)
-		printf("USB error: all controllers failed lowlevel init\n");
+	if (controllers_initialized == 0)
+		printf("No working controllers found\n");
 
 	return usb_started ? 0 : -1;
 }
Signature · 1 line
2.19.1
#1 lore raw

PATCH v3 1/1 usb: host: Print device name when scanning

Quoted 4 lines · Ismael Luceno Cortes

Drop the counter, it has no meaning other than being the order in which the interface is found; the name assigned to the USB host controller interface is a better indicator.

Quoted 8 lines

Example of the original output:

Quoted 3 lines

USB0: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found

Patched output:

Quoted 2 lines

Bus usb at ee080100: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found

^
'-- here it still says 0, why ?
it's not very consistent :)

Otherwise looks good to me .

Quoted 51 lines
Quoted 1 line

scanning usb for storage devices... 1 Storage Device(s) found

---

Notes:
Changes since v2:
- Dropped counter altogether.

Changes since v1:
- Improved commit message.

 drivers/usb/host/usb-uclass.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/usb/host/usb-uclass.c +3 -7
index 611ea97a72..a7179abc3a 100644
@@ -242,7 +242,6 @@ int usb_init(void)
 	struct usb_bus_priv *priv;
 	struct udevice *bus;
 	struct uclass *uc;
-	int count = 0;
 	int ret;
 
 	asynch_allowed = 1;
@@ -255,8 +254,7 @@ int usb_init(void)
 
 	uclass_foreach_dev(bus, uc) {
 		/* init low_level USB */
-		printf("USB%d:   ", count);
-		count++;
+		printf("Bus %s:   ", bus->name);
 
 #ifdef CONFIG_SANDBOX
 		/*
@@ -327,10 +325,8 @@ int usb_init(void)
 	remove_inactive_children(uc, bus);
 
 	/* if we were not able to find at least one working bus, bail out */
-	if (!count)
-		printf("No controllers found\n");
-	else if (controllers_initialized == 0)
-		printf("USB error: all controllers failed lowlevel init\n");
+	if (controllers_initialized == 0)
+		printf("No working controllers found\n");
 
 	return usb_started ? 0 : -1;
 }
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v3 1/1 usb: host: Print device name when scanning

Quoted 10 lines · Marek Vasut
Quoted 9 lines · Ismael Luceno Cortes

Drop the counter, it has no meaning other than being the order in which the interface is found; the name assigned to the USB host controller interface is a better indicator.

Example of the original output:

Quoted 3 lines

USB0: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found

Quoted 6 lines
Quoted 3 lines

Patched output:

Quoted 2 lines

Bus usb at ee080100: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found

^
'-- here it still says 0, why ?
it's not very consistent :)

Good point, I'll remove that one, it seems it used to be the same thing but now comes from dev->seq.

#3 lore raw

PATCH v3 1/1 usb: host: Print device name when scanning

Quoted 12 lines · Ismael Luceno Cortes
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Ismael Luceno Cortes

Drop the counter, it has no meaning other than being the order in which the interface is found; the name assigned to the USB host controller interface is a better indicator.

Example of the original output:

Quoted 3 lines

USB0: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found

Patched output:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

Bus usb at ee080100: USB EHCI 1.10
scanning bus 0 for devices... 2 USB Device(s) found

^
'-- here it still says 0, why ?
it's not very consistent :)

Good point, I'll remove that one, it seems it used to be the same thing but now comes from dev->seq.

Thanks!

Signature · 2 lines
Best regards,
Marek Vasut