diff mbox series

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

Message ID 20190218092353.4710-1-ismael.luceno@silicon-gears.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series [U-Boot] usb: host: Print device name when scanning | expand

Commit Message

Ismael Luceno Cortes Feb. 18, 2019, 9:23 a.m. UTC
Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
---
 drivers/usb/host/usb-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ismael Luceno Cortes March 14, 2019, 11:44 a.m. UTC | #1
On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> ---
>  drivers/usb/host/usb-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> index 611ea97a72..0575f5393b 100644
> --- a/drivers/usb/host/usb-uclass.c
> +++ b/drivers/usb/host/usb-uclass.c
> @@ -255,7 +255,7 @@ int usb_init(void)
>  
>  	uclass_foreach_dev(bus, uc) {
>  		/* init low_level USB */
> -		printf("USB%d:   ", count);
> +		printf("USB%d(%s):   ", count, bus->name);
>  		count++;
>  
>  #ifdef CONFIG_SANDBOX
> -- 
> 2.19.1

Ping.
Marek Vasut March 14, 2019, 11:55 a.m. UTC | #2
On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
>> ---
>>  drivers/usb/host/usb-uclass.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
>> index 611ea97a72..0575f5393b 100644
>> --- a/drivers/usb/host/usb-uclass.c
>> +++ b/drivers/usb/host/usb-uclass.c
>> @@ -255,7 +255,7 @@ int usb_init(void)
>>  
>>  	uclass_foreach_dev(bus, uc) {
>>  		/* init low_level USB */
>> -		printf("USB%d:   ", count);
>> +		printf("USB%d(%s):   ", count, bus->name);
>>  		count++;
>>  
>>  #ifdef CONFIG_SANDBOX
>> -- 
>> 2.19.1
> 
> Ping.

What is this patch doing ? The commit description doesn't explain
anything about it.
Ismael Luceno Cortes March 14, 2019, 12:57 p.m. UTC | #3
On 14/Mar/2019 12:55, Marek Vasut wrote:
> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
> > On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
> >> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> >> ---
> >>  drivers/usb/host/usb-uclass.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> >> index 611ea97a72..0575f5393b 100644
> >> --- a/drivers/usb/host/usb-uclass.c
> >> +++ b/drivers/usb/host/usb-uclass.c
> >> @@ -255,7 +255,7 @@ int usb_init(void)
> >>  
> >>  	uclass_foreach_dev(bus, uc) {
> >>  		/* init low_level USB */
> >> -		printf("USB%d:   ", count);
> >> +		printf("USB%d(%s):   ", count, bus->name);
> >>  		count++;
> >>  
> >>  #ifdef CONFIG_SANDBOX
> >> -- 
> >> 2.19.1
> > 
> > Ping.
> 
> What is this patch doing ? The commit description doesn't explain
> anything about it.

It prints the host device name. I'm not sure the count is at all useful
given there's a name...
Marek Vasut March 14, 2019, 3:09 p.m. UTC | #4
On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
> On 14/Mar/2019 12:55, Marek Vasut wrote:
>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
>>>> ---
>>>>  drivers/usb/host/usb-uclass.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
>>>> index 611ea97a72..0575f5393b 100644
>>>> --- a/drivers/usb/host/usb-uclass.c
>>>> +++ b/drivers/usb/host/usb-uclass.c
>>>> @@ -255,7 +255,7 @@ int usb_init(void)
>>>>  
>>>>  	uclass_foreach_dev(bus, uc) {
>>>>  		/* init low_level USB */
>>>> -		printf("USB%d:   ", count);
>>>> +		printf("USB%d(%s):   ", count, bus->name);
>>>>  		count++;
>>>>  
>>>>  #ifdef CONFIG_SANDBOX
>>>> -- 
>>>> 2.19.1
>>>
>>> Ping.
>>
>> What is this patch doing ? The commit description doesn't explain
>> anything about it.
> 
> It prints the host device name. I'm not sure the count is at all useful
> given there's a name...

If you could share the log before and after to better illustrate the
difference, that'd be nice.

However, shouldn't the same approach be applied to 'usb tree' subcommand
and possibly others ?
Ismael Luceno Cortes March 14, 2019, 4:19 p.m. UTC | #5
On 14/Mar/2019 16:09, Marek Vasut wrote:
> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
> > On 14/Mar/2019 12:55, Marek Vasut wrote:
> >> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
> >>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
> >>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> >>>> ---
> >>>>  drivers/usb/host/usb-uclass.c | 2 +-
> >>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>
> >>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> >>>> index 611ea97a72..0575f5393b 100644
> >>>> --- a/drivers/usb/host/usb-uclass.c
> >>>> +++ b/drivers/usb/host/usb-uclass.c
> >>>> @@ -255,7 +255,7 @@ int usb_init(void)
> >>>>  
> >>>>  	uclass_foreach_dev(bus, uc) {
> >>>>  		/* init low_level USB */
> >>>> -		printf("USB%d:   ", count);
> >>>> +		printf("USB%d(%s):   ", count, bus->name);
> >>>>  		count++;
> >>>>  
> >>>>  #ifdef CONFIG_SANDBOX
> >>>> -- 
> >>>> 2.19.1
> >>>
> >>> Ping.
> >>
> >> What is this patch doing ? The commit description doesn't explain
> >> anything about it.
> > 
> > It prints the host device name. I'm not sure the count is at all useful
> > given there's a name...
> 
> If you could share the log before and after to better illustrate the
> difference, that'd be nice.

unpatched:

=> usb reset
resetting USB...
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:

=> usb reset
resetting USB...
USB0(usb@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

> However, shouldn't the same approach be applied to 'usb tree' subcommand
> and possibly others ?

The number shown during usb scanning is not used nor saved anywhere
else, so seems pretty useless and a special case.

OTOH the number used in the usb tree command is taken from struct
usb_device, and is used for lookups.

The name is only relevant to non-discoverable devices at the moment.

dm tree shows:
... ehci_generic          |   |-- usb@ee080100
... usb_hub               |   |   `-- usb_hub
... usb_mass_storage      |   |       `-- usb_mass_storage
... usb_storage_blk       |   |           `-- usb_mass_storage.lun0
Marek Vasut March 15, 2019, 5:34 p.m. UTC | #6
On 3/14/19 5:19 PM, Ismael Luceno Cortes wrote:
> On 14/Mar/2019 16:09, Marek Vasut wrote:
>> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
>>> On 14/Mar/2019 12:55, Marek Vasut wrote:
>>>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
>>>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
>>>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
>>>>>> ---
>>>>>>  drivers/usb/host/usb-uclass.c | 2 +-
>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
>>>>>> index 611ea97a72..0575f5393b 100644
>>>>>> --- a/drivers/usb/host/usb-uclass.c
>>>>>> +++ b/drivers/usb/host/usb-uclass.c
>>>>>> @@ -255,7 +255,7 @@ int usb_init(void)
>>>>>>  
>>>>>>  	uclass_foreach_dev(bus, uc) {
>>>>>>  		/* init low_level USB */
>>>>>> -		printf("USB%d:   ", count);
>>>>>> +		printf("USB%d(%s):   ", count, bus->name);
>>>>>>  		count++;
>>>>>>  
>>>>>>  #ifdef CONFIG_SANDBOX
>>>>>> -- 
>>>>>> 2.19.1
>>>>>
>>>>> Ping.
>>>>
>>>> What is this patch doing ? The commit description doesn't explain
>>>> anything about it.
>>>
>>> It prints the host device name. I'm not sure the count is at all useful
>>> given there's a name...
>>
>> If you could share the log before and after to better illustrate the
>> difference, that'd be nice.
> 
> unpatched:
> 
> => usb reset
> resetting USB...
> 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:
> 
> => usb reset
> resetting USB...
> USB0(usb@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
> 
>> However, shouldn't the same approach be applied to 'usb tree' subcommand
>> and possibly others ?
> 
> The number shown during usb scanning is not used nor saved anywhere
> else, so seems pretty useless and a special case.

What about usb part ? That one uses the number somehow I think ?

> OTOH the number used in the usb tree command is taken from struct
> usb_device, and is used for lookups.

Maybe it's time to clean that numbering mess up a bit , and make it
consistent ?

> The name is only relevant to non-discoverable devices at the moment.
> 
> dm tree shows:
> ... ehci_generic          |   |-- usb@ee080100
> ... usb_hub               |   |   `-- usb_hub
> ... usb_mass_storage      |   |       `-- usb_mass_storage
> ... usb_storage_blk       |   |           `-- usb_mass_storage.lun0
>
Ismael Luceno Cortes March 15, 2019, 7:50 p.m. UTC | #7
On 15/Mar/2019 18:34, Marek Vasut wrote:
> On 3/14/19 5:19 PM, Ismael Luceno Cortes wrote:
> > On 14/Mar/2019 16:09, Marek Vasut wrote:
> >> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
> >>> On 14/Mar/2019 12:55, Marek Vasut wrote:
> >>>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
> >>>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
> >>>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> >>>>>> ---
> >>>>>>  drivers/usb/host/usb-uclass.c | 2 +-
> >>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>
> >>>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> >>>>>> index 611ea97a72..0575f5393b 100644
> >>>>>> --- a/drivers/usb/host/usb-uclass.c
> >>>>>> +++ b/drivers/usb/host/usb-uclass.c
> >>>>>> @@ -255,7 +255,7 @@ int usb_init(void)
> >>>>>>  
> >>>>>>  	uclass_foreach_dev(bus, uc) {
> >>>>>>  		/* init low_level USB */
> >>>>>> -		printf("USB%d:   ", count);
> >>>>>> +		printf("USB%d(%s):   ", count, bus->name);
> >>>>>>  		count++;
> >>>>>>  
> >>>>>>  #ifdef CONFIG_SANDBOX
> >>>>>> -- 
> >>>>>> 2.19.1
> >>>>>
> >>>>> Ping.
> >>>>
> >>>> What is this patch doing ? The commit description doesn't explain
> >>>> anything about it.
> >>>
> >>> It prints the host device name. I'm not sure the count is at all useful
> >>> given there's a name...
> >>
> >> If you could share the log before and after to better illustrate the
> >> difference, that'd be nice.
> > 
> > unpatched:
> > 
> > => usb reset
> > resetting USB...
> > 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:
> > 
> > => usb reset
> > resetting USB...
> > USB0(usb@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
> > 
> >> However, shouldn't the same approach be applied to 'usb tree' subcommand
> >> and possibly others ?
> > 
> > The number shown during usb scanning is not used nor saved anywhere
> > else, so seems pretty useless and a special case.
> 
> What about usb part ? That one uses the number somehow I think ?

Not this number.

> > OTOH the number used in the usb tree command is taken from struct
> > usb_device, and is used for lookups.
> 
> Maybe it's time to clean that numbering mess up a bit , and make it
> consistent ?

Maybe implement it like a vfs? It would force some consistency into the
drivers and commands.
Marek Vasut March 16, 2019, 1:41 a.m. UTC | #8
On 3/15/19 8:50 PM, Ismael Luceno Cortes wrote:
> On 15/Mar/2019 18:34, Marek Vasut wrote:
>> On 3/14/19 5:19 PM, Ismael Luceno Cortes wrote:
>>> On 14/Mar/2019 16:09, Marek Vasut wrote:
>>>> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
>>>>> On 14/Mar/2019 12:55, Marek Vasut wrote:
>>>>>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
>>>>>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
>>>>>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
>>>>>>>> ---
>>>>>>>>  drivers/usb/host/usb-uclass.c | 2 +-
>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>
>>>>>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
>>>>>>>> index 611ea97a72..0575f5393b 100644
>>>>>>>> --- a/drivers/usb/host/usb-uclass.c
>>>>>>>> +++ b/drivers/usb/host/usb-uclass.c
>>>>>>>> @@ -255,7 +255,7 @@ int usb_init(void)
>>>>>>>>  
>>>>>>>>  	uclass_foreach_dev(bus, uc) {
>>>>>>>>  		/* init low_level USB */
>>>>>>>> -		printf("USB%d:   ", count);
>>>>>>>> +		printf("USB%d(%s):   ", count, bus->name);
>>>>>>>>  		count++;
>>>>>>>>  
>>>>>>>>  #ifdef CONFIG_SANDBOX
>>>>>>>> -- 
>>>>>>>> 2.19.1
>>>>>>>
>>>>>>> Ping.
>>>>>>
>>>>>> What is this patch doing ? The commit description doesn't explain
>>>>>> anything about it.
>>>>>
>>>>> It prints the host device name. I'm not sure the count is at all useful
>>>>> given there's a name...
>>>>
>>>> If you could share the log before and after to better illustrate the
>>>> difference, that'd be nice.
>>>
>>> unpatched:
>>>
>>> => usb reset
>>> resetting USB...
>>> 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:
>>>
>>> => usb reset
>>> resetting USB...
>>> USB0(usb@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
>>>
>>>> However, shouldn't the same approach be applied to 'usb tree' subcommand
>>>> and possibly others ?
>>>
>>> The number shown during usb scanning is not used nor saved anywhere
>>> else, so seems pretty useless and a special case.
>>
>> What about usb part ? That one uses the number somehow I think ?
> 
> Not this number.

Lovely.

Anyway, this looks good, can you repost this patch with proper commit
message, ideally with the example output above so I can pick it for next ?

>>> OTOH the number used in the usb tree command is taken from struct
>>> usb_device, and is used for lookups.
>>
>> Maybe it's time to clean that numbering mess up a bit , and make it
>> consistent ?
> 
> Maybe implement it like a vfs? It would force some consistency into the
> drivers and commands.

Do you want to take that one up ? :)
Ismael Luceno Cortes March 18, 2019, 12:02 p.m. UTC | #9
On 16/Mar/2019 02:41, Marek Vasut wrote:
> On 3/15/19 8:50 PM, Ismael Luceno Cortes wrote:
> > On 15/Mar/2019 18:34, Marek Vasut wrote:
> >> On 3/14/19 5:19 PM, Ismael Luceno Cortes wrote:
> >>> On 14/Mar/2019 16:09, Marek Vasut wrote:
> >>>> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
> >>>>> On 14/Mar/2019 12:55, Marek Vasut wrote:
> >>>>>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
> >>>>>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
> >>>>>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
> >>>>>>>> ---
> >>>>>>>>  drivers/usb/host/usb-uclass.c | 2 +-
> >>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>>>>>>
> >>>>>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
> >>>>>>>> index 611ea97a72..0575f5393b 100644
> >>>>>>>> --- a/drivers/usb/host/usb-uclass.c
> >>>>>>>> +++ b/drivers/usb/host/usb-uclass.c
> >>>>>>>> @@ -255,7 +255,7 @@ int usb_init(void)
> >>>>>>>>  
> >>>>>>>>  	uclass_foreach_dev(bus, uc) {
> >>>>>>>>  		/* init low_level USB */
> >>>>>>>> -		printf("USB%d:   ", count);
> >>>>>>>> +		printf("USB%d(%s):   ", count, bus->name);
> >>>>>>>>  		count++;
> >>>>>>>>  
> >>>>>>>>  #ifdef CONFIG_SANDBOX
> >>>>>>>> -- 
> >>>>>>>> 2.19.1
> >>>>>>>
> >>>>>>> Ping.
> >>>>>>
> >>>>>> What is this patch doing ? The commit description doesn't explain
> >>>>>> anything about it.
> >>>>>
> >>>>> It prints the host device name. I'm not sure the count is at all useful
> >>>>> given there's a name...
> >>>>
> >>>> If you could share the log before and after to better illustrate the
> >>>> difference, that'd be nice.
> >>>
> >>> unpatched:
> >>>
> >>> => usb reset
> >>> resetting USB...
> >>> 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:
> >>>
> >>> => usb reset
> >>> resetting USB...
> >>> USB0(usb@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
> >>>
> >>>> However, shouldn't the same approach be applied to 'usb tree' subcommand
> >>>> and possibly others ?
> >>>
> >>> The number shown during usb scanning is not used nor saved anywhere
> >>> else, so seems pretty useless and a special case.
> >>
> >> What about usb part ? That one uses the number somehow I think ?
> > 
> > Not this number.
> 
> Lovely.
> 
> Anyway, this looks good, can you repost this patch with proper commit
> message, ideally with the example output above so I can pick it for next ?

Ok.

> >>> OTOH the number used in the usb tree command is taken from struct
> >>> usb_device, and is used for lookups.
> >>
> >> Maybe it's time to clean that numbering mess up a bit , and make it
> >> consistent ?
> > 
> > Maybe implement it like a vfs? It would force some consistency into the
> > drivers and commands.
> 
> Do you want to take that one up ? :)

I would consider implementing it. Is there any preferences?
Marek Vasut March 18, 2019, 12:04 p.m. UTC | #10
On 3/18/19 1:02 PM, Ismael Luceno Cortes wrote:
> On 16/Mar/2019 02:41, Marek Vasut wrote:
>> On 3/15/19 8:50 PM, Ismael Luceno Cortes wrote:
>>> On 15/Mar/2019 18:34, Marek Vasut wrote:
>>>> On 3/14/19 5:19 PM, Ismael Luceno Cortes wrote:
>>>>> On 14/Mar/2019 16:09, Marek Vasut wrote:
>>>>>> On 3/14/19 1:57 PM, Ismael Luceno Cortes wrote:
>>>>>>> On 14/Mar/2019 12:55, Marek Vasut wrote:
>>>>>>>> On 3/14/19 12:44 PM, Ismael Luceno Cortes wrote:
>>>>>>>>> On 18/Feb/2019 09:23, Ismael Luceno Cortes wrote:
>>>>>>>>>> Signed-off-by: Ismael Luceno <ismael.luceno@silicon-gears.com>
>>>>>>>>>> ---
>>>>>>>>>>  drivers/usb/host/usb-uclass.c | 2 +-
>>>>>>>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>>>>>>
>>>>>>>>>> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
>>>>>>>>>> index 611ea97a72..0575f5393b 100644
>>>>>>>>>> --- a/drivers/usb/host/usb-uclass.c
>>>>>>>>>> +++ b/drivers/usb/host/usb-uclass.c
>>>>>>>>>> @@ -255,7 +255,7 @@ int usb_init(void)
>>>>>>>>>>  
>>>>>>>>>>  	uclass_foreach_dev(bus, uc) {
>>>>>>>>>>  		/* init low_level USB */
>>>>>>>>>> -		printf("USB%d:   ", count);
>>>>>>>>>> +		printf("USB%d(%s):   ", count, bus->name);
>>>>>>>>>>  		count++;
>>>>>>>>>>  
>>>>>>>>>>  #ifdef CONFIG_SANDBOX
>>>>>>>>>> -- 
>>>>>>>>>> 2.19.1
>>>>>>>>>
>>>>>>>>> Ping.
>>>>>>>>
>>>>>>>> What is this patch doing ? The commit description doesn't explain
>>>>>>>> anything about it.
>>>>>>>
>>>>>>> It prints the host device name. I'm not sure the count is at all useful
>>>>>>> given there's a name...
>>>>>>
>>>>>> If you could share the log before and after to better illustrate the
>>>>>> difference, that'd be nice.
>>>>>
>>>>> unpatched:
>>>>>
>>>>> => usb reset
>>>>> resetting USB...
>>>>> 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:
>>>>>
>>>>> => usb reset
>>>>> resetting USB...
>>>>> USB0(usb@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
>>>>>
>>>>>> However, shouldn't the same approach be applied to 'usb tree' subcommand
>>>>>> and possibly others ?
>>>>>
>>>>> The number shown during usb scanning is not used nor saved anywhere
>>>>> else, so seems pretty useless and a special case.
>>>>
>>>> What about usb part ? That one uses the number somehow I think ?
>>>
>>> Not this number.
>>
>> Lovely.
>>
>> Anyway, this looks good, can you repost this patch with proper commit
>> message, ideally with the example output above so I can pick it for next ?
> 
> Ok.
> 
>>>>> OTOH the number used in the usb tree command is taken from struct
>>>>> usb_device, and is used for lookups.
>>>>
>>>> Maybe it's time to clean that numbering mess up a bit , and make it
>>>> consistent ?
>>>
>>> Maybe implement it like a vfs? It would force some consistency into the
>>> drivers and commands.
>>
>> Do you want to take that one up ? :)
> 
> I would consider implementing it. Is there any preferences?

Prepare an RFC patchset and we'll see how that looks :)
diff mbox series

Patch

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 611ea97a72..0575f5393b 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -255,7 +255,7 @@  int usb_init(void)
 
 	uclass_foreach_dev(bus, uc) {
 		/* init low_level USB */
-		printf("USB%d:   ", count);
+		printf("USB%d(%s):   ", count, bus->name);
 		count++;
 
 #ifdef CONFIG_SANDBOX