[U-Boot] [PATCH v3] usb: host: Print device name when scanning

Marek Vasut marek.vasut at gmail.com
Tue Mar 19 01:14:13 UTC 2019


On 3/18/19 2:21 PM, Ismael Luceno Cortes wrote:
> 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:
>> 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:
>> 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 .

>>        scanning usb for storage devices... 1 Storage Device(s) found
> 
> Signed-off-by: Ismael Luceno <ismael.luceno at silicon-gears.com>
> ---
> 
> 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(-)
> 
> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> index 611ea97a72..a7179abc3a 100644
> --- a/drivers/usb/host/usb-uclass.c
> +++ b/drivers/usb/host/usb-uclass.c
> @@ -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;
>  }
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list