diff mbox series

[1/1] usb: informative message if no controller

Message ID 20240617081654.74294-1-heinrich.schuchardt@canonical.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series [1/1] usb: informative message if no controller | expand

Commit Message

Heinrich Schuchardt June 17, 2024, 8:16 a.m. UTC
The message 'No working controllers found' provides no clue that this
refers to USB controllers.

Provide a message that refers to USB. Use log_info().

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 drivers/usb/host/usb-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dragan Simic June 17, 2024, 8:20 a.m. UTC | #1
Hello Heinrich,

On 2024-06-17 10:16, Heinrich Schuchardt wrote:
> The message 'No working controllers found' provides no clue that this
> refers to USB controllers.
> 
> Provide a message that refers to USB. Use log_info().
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.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 a1cd0ad2d66..e16432a1516 100644
> --- a/drivers/usb/host/usb-uclass.c
> +++ b/drivers/usb/host/usb-uclass.c
> @@ -388,7 +388,7 @@ int usb_init(void)
> 
>  	/* if we were not able to find at least one working bus, bail out */
>  	if (controllers_initialized == 0)
> -		printf("No working controllers found\n");
> +		log_info("No USB controller\n");

It would be better to use "No USB controllers found" as the error 
message,
because it reads better and provides additional clues.

>  	return usb_started ? 0 : -ENOENT;
>  }
Marek Vasut June 17, 2024, 2:52 p.m. UTC | #2
On 6/17/24 10:20 AM, Dragan Simic wrote:
> Hello Heinrich,
> 
> On 2024-06-17 10:16, Heinrich Schuchardt wrote:
>> The message 'No working controllers found' provides no clue that this
>> refers to USB controllers.
>>
>> Provide a message that refers to USB. Use log_info().
>>
>> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.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 a1cd0ad2d66..e16432a1516 100644
>> --- a/drivers/usb/host/usb-uclass.c
>> +++ b/drivers/usb/host/usb-uclass.c
>> @@ -388,7 +388,7 @@ int usb_init(void)
>>
>>      /* if we were not able to find at least one working bus, bail out */
>>      if (controllers_initialized == 0)
>> -        printf("No working controllers found\n");
>> +        log_info("No USB controller\n");
> 
> It would be better to use "No USB controllers found" as the error message,
> because it reads better and provides additional clues.

Yes, that is indeed better. Also, please keep the printf() and do the 
log_info change in separate patch.
diff mbox series

Patch

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index a1cd0ad2d66..e16432a1516 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -388,7 +388,7 @@  int usb_init(void)
 
 	/* if we were not able to find at least one working bus, bail out */
 	if (controllers_initialized == 0)
-		printf("No working controllers found\n");
+		log_info("No USB controller\n");
 
 	return usb_started ? 0 : -ENOENT;
 }