Skip to contentSkip to conversation

dm: usb: Do not use bus->seq before device_probe(bus)

PATCH New Hans de Goede 2 participants 3 messages May 4, 2015 – May 5, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm: usb: Do not use bus->seq before device_probe(bus)

Do not use bus->seq before device_probe(bus), as bus->seq is not set until
after the device_probe() call. This fixes u-boot printing: "USB-1: " for
each bus it scans.

---
 drivers/usb/host/usb-uclass.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/usb-uclass.c +1 -2
index 3655435..dd721cb 100644
@@ -181,9 +181,8 @@ int usb_init(void)
 
 	uclass_foreach_dev(bus, uc) {
 		/* init low_level USB */
+		printf("USB%d:   ", count);
 		count++;
-		printf("USB");
-		printf("%d:   ", bus->seq);
 		ret = device_probe(bus);
 		if (ret == -ENODEV) {	/* No such device. */
 			puts("Port not available.\n");
Signature · 1 line
2.3.6
#1 lore raw

PATCH 1/1 dm: usb: Do not use bus->seq before device_probe(bus)

Hi Hans,

Quoted 14 lines · Hans de Goede

Do not use bus->seq before device_probe(bus), as bus->seq is not set until
after the device_probe() call. This fixes u-boot printing: "USB-1: " for
each bus it scans.

---
 drivers/usb/host/usb-uclass.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/usb-uclass.c +0 -0
index 3655435..dd721cb 100644

drivers/usb/host/usb-uclass.c int usb_init(void) · line 184

Quoted 4 lines
drivers/usb/host/usb-uclass.c +1 -0
@@ -181,9 +181,8 @@ int usb_init(void)
 
        uclass_foreach_dev(bus, uc) {
                /* init low_level USB */
+               printf("USB%d:   ", count);

This might be confusing if bus->seq ends up being something else. But I don't have a better idea and I've been thinking about it for a while.

Quoted 9 lines
drivers/usb/host/usb-uclass.c +0 -3
                count++;
-               printf("USB");
-               printf("%d:   ", bus->seq);
                ret = device_probe(bus);
                if (ret == -ENODEV) {   /* No such device. */
                        puts("Port not available.\n");
--

2.3.6

Regards,
Simon

#2 lore raw

PATCH 1/1 dm: usb: Do not use bus->seq before device_probe(bus)

Quoted 38 lines · Simon Glass

Hi Hans,

Quoted 14 lines · Hans de Goede

Do not use bus->seq before device_probe(bus), as bus->seq is not set until
after the device_probe() call. This fixes u-boot printing: "USB-1: " for
each bus it scans.

---
 drivers/usb/host/usb-uclass.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/usb-uclass.c +0 -0
index 3655435..dd721cb 100644

drivers/usb/host/usb-uclass.c int usb_init(void) · line 184

Quoted 4 lines
drivers/usb/host/usb-uclass.c +1 -0
@@ -181,9 +181,8 @@ int usb_init(void)
 
        uclass_foreach_dev(bus, uc) {
                /* init low_level USB */
+               printf("USB%d:   ", count);

This might be confusing if bus->seq ends up being something else. But I don't have a better idea and I've been thinking about it for a while.

Quoted 9 lines
drivers/usb/host/usb-uclass.c +0 -3
                count++;
-               printf("USB");
-               printf("%d:   ", bus->seq);
                ret = device_probe(bus);
                if (ret == -ENODEV) {   /* No such device. */
                        puts("Port not available.\n");
--

2.3.6

Quoted 2 lines

Regards,
Simon

Applied to u-boot-dm, thanks!