linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] USB:XHCI:Adjust the log level of hub
@ 2021-03-25 10:04 Longfang Liu
  2021-03-25 10:31 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Longfang Liu @ 2021-03-25 10:04 UTC (permalink / raw)
  To: gregkh, mathias.nyman, stern
  Cc: linux-usb, yisen.zhuang, tanxiaofei, liudongdong3, liulongfang,
	linux-kernel

When the number of ports of the hub is not between 1 and Maxports,
it will only exit the registration of the hub on the current controller,
but it will not affect the function of the controller itself. Its other
hubs can operate normally, so the log level here can be changed from
error to information.

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
---
 drivers/usb/core/hub.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index b1e14be..70294ad 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1409,13 +1409,11 @@ static int hub_configure(struct usb_hub *hub,
 		maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);
 
 	if (hub->descriptor->bNbrPorts > maxchild) {
-		message = "hub has too many ports!";
-		ret = -ENODEV;
-		goto fail;
+		dev_info(hub_dev, "hub has too many ports!\n");
+		return -ENODEV;
 	} else if (hub->descriptor->bNbrPorts == 0) {
-		message = "hub doesn't have any ports!";
-		ret = -ENODEV;
-		goto fail;
+		dev_info(hub_dev, "hub doesn't have any ports!\n");
+		return -ENODEV;
 	}
 
 	/*
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] USB:XHCI:Adjust the log level of hub
  2021-03-25 10:04 [RFC PATCH] USB:XHCI:Adjust the log level of hub Longfang Liu
@ 2021-03-25 10:31 ` Greg KH
  2021-03-25 13:33   ` liulongfang
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2021-03-25 10:31 UTC (permalink / raw)
  To: Longfang Liu
  Cc: mathias.nyman, stern, linux-usb, yisen.zhuang, tanxiaofei,
	liudongdong3, linux-kernel

On Thu, Mar 25, 2021 at 06:04:12PM +0800, Longfang Liu wrote:
> When the number of ports of the hub is not between 1 and Maxports,
> it will only exit the registration of the hub on the current controller,
> but it will not affect the function of the controller itself. Its other
> hubs can operate normally, so the log level here can be changed from
> error to information.
> 
> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> ---
>  drivers/usb/core/hub.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index b1e14be..70294ad 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -1409,13 +1409,11 @@ static int hub_configure(struct usb_hub *hub,
>  		maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);
>  
>  	if (hub->descriptor->bNbrPorts > maxchild) {
> -		message = "hub has too many ports!";
> -		ret = -ENODEV;
> -		goto fail;
> +		dev_info(hub_dev, "hub has too many ports!\n");

Is this an error?  If so, report it as such, not as "information".

> +		return -ENODEV;
>  	} else if (hub->descriptor->bNbrPorts == 0) {
> -		message = "hub doesn't have any ports!";
> -		ret = -ENODEV;
> -		goto fail;
> +		dev_info(hub_dev, "hub doesn't have any ports!\n");

Same here.

What problem are you trying to solve here?

What hub do you have that has no ports, or too many, that you think
should still be able to work properly?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] USB:XHCI:Adjust the log level of hub
  2021-03-25 10:31 ` Greg KH
@ 2021-03-25 13:33   ` liulongfang
  2021-03-25 13:59     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: liulongfang @ 2021-03-25 13:33 UTC (permalink / raw)
  To: Greg KH
  Cc: mathias.nyman, stern, linux-usb, yisen.zhuang, tanxiaofei,
	liudongdong3, linux-kernel

On 2021/3/25 18:31, Greg KH wrote:
> On Thu, Mar 25, 2021 at 06:04:12PM +0800, Longfang Liu wrote:
>> When the number of ports of the hub is not between 1 and Maxports,
>> it will only exit the registration of the hub on the current controller,
>> but it will not affect the function of the controller itself. Its other
>> hubs can operate normally, so the log level here can be changed from
>> error to information.
>>
>> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
>> ---
>>  drivers/usb/core/hub.c | 10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
>> index b1e14be..70294ad 100644
>> --- a/drivers/usb/core/hub.c
>> +++ b/drivers/usb/core/hub.c
>> @@ -1409,13 +1409,11 @@ static int hub_configure(struct usb_hub *hub,
>>  		maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);
>>  
>>  	if (hub->descriptor->bNbrPorts > maxchild) {
>> -		message = "hub has too many ports!";
>> -		ret = -ENODEV;
>> -		goto fail;
>> +		dev_info(hub_dev, "hub has too many ports!\n");
> 
> Is this an error?  If so, report it as such, not as "information".
> 
>> +		return -ENODEV;
>>  	} else if (hub->descriptor->bNbrPorts == 0) {
>> -		message = "hub doesn't have any ports!";
>> -		ret = -ENODEV;
>> -		goto fail;
>> +		dev_info(hub_dev, "hub doesn't have any ports!\n");
> 
> Same here.
> 
> What problem are you trying to solve here?
> 
> What hub do you have that has no ports, or too many, that you think
> should still be able to work properly?
> 
> thanks,
> 
> greg k-h
> .
>On our test platform, the xhci usb3 hub has no port.
when initializing the usb3 hub, an error will be reported
because the port is 0, but in fact it will not affect
the use of usb2, and the usb2 hub is working normally.
thanks, therefore, in order to reduce the severity of the log,
we hope to lower the level of this log.
Longfang
thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] USB:XHCI:Adjust the log level of hub
  2021-03-25 13:33   ` liulongfang
@ 2021-03-25 13:59     ` Greg KH
  2021-03-25 14:31       ` Alan Stern
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2021-03-25 13:59 UTC (permalink / raw)
  To: liulongfang
  Cc: mathias.nyman, stern, linux-usb, yisen.zhuang, tanxiaofei,
	liudongdong3, linux-kernel

On Thu, Mar 25, 2021 at 09:33:53PM +0800, liulongfang wrote:
> On 2021/3/25 18:31, Greg KH wrote:
> > On Thu, Mar 25, 2021 at 06:04:12PM +0800, Longfang Liu wrote:
> >> When the number of ports of the hub is not between 1 and Maxports,
> >> it will only exit the registration of the hub on the current controller,
> >> but it will not affect the function of the controller itself. Its other
> >> hubs can operate normally, so the log level here can be changed from
> >> error to information.
> >>
> >> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> >> ---
> >>  drivers/usb/core/hub.c | 10 ++++------
> >>  1 file changed, 4 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> >> index b1e14be..70294ad 100644
> >> --- a/drivers/usb/core/hub.c
> >> +++ b/drivers/usb/core/hub.c
> >> @@ -1409,13 +1409,11 @@ static int hub_configure(struct usb_hub *hub,
> >>  		maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);
> >>  
> >>  	if (hub->descriptor->bNbrPorts > maxchild) {
> >> -		message = "hub has too many ports!";
> >> -		ret = -ENODEV;
> >> -		goto fail;
> >> +		dev_info(hub_dev, "hub has too many ports!\n");
> > 
> > Is this an error?  If so, report it as such, not as "information".
> > 
> >> +		return -ENODEV;
> >>  	} else if (hub->descriptor->bNbrPorts == 0) {
> >> -		message = "hub doesn't have any ports!";
> >> -		ret = -ENODEV;
> >> -		goto fail;
> >> +		dev_info(hub_dev, "hub doesn't have any ports!\n");
> > 
> > Same here.
> > 
> > What problem are you trying to solve here?
> > 
> > What hub do you have that has no ports, or too many, that you think
> > should still be able to work properly?
> > 
> > thanks,
> > 
> > greg k-h
> > .
> On our test platform, the xhci usb3 hub has no port.

Sounds like a broken device, why not fix that?

> when initializing the usb3 hub, an error will be reported
> because the port is 0, but in fact it will not affect
> the use of usb2, and the usb2 hub is working normally.

But you can not have a USB3 hub with no ports, isn't that against
against the USB spec?  How does this device pass the USB-IF
certification?

> thanks, therefore, in order to reduce the severity of the log,
> we hope to lower the level of this log.

You did not reduce the severity at all, everyone can still see it.

Please try fixing your hardware :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC PATCH] USB:XHCI:Adjust the log level of hub
  2021-03-25 13:59     ` Greg KH
@ 2021-03-25 14:31       ` Alan Stern
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Stern @ 2021-03-25 14:31 UTC (permalink / raw)
  To: Greg KH
  Cc: liulongfang, mathias.nyman, linux-usb, yisen.zhuang, tanxiaofei,
	liudongdong3, linux-kernel

On Thu, Mar 25, 2021 at 02:59:03PM +0100, Greg KH wrote:
> On Thu, Mar 25, 2021 at 09:33:53PM +0800, liulongfang wrote:
> > On 2021/3/25 18:31, Greg KH wrote:
> > > On Thu, Mar 25, 2021 at 06:04:12PM +0800, Longfang Liu wrote:
> > >> When the number of ports of the hub is not between 1 and Maxports,
> > >> it will only exit the registration of the hub on the current controller,
> > >> but it will not affect the function of the controller itself. Its other
> > >> hubs can operate normally, so the log level here can be changed from
> > >> error to information.
> > >>
> > >> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> > >> ---
> > >>  drivers/usb/core/hub.c | 10 ++++------
> > >>  1 file changed, 4 insertions(+), 6 deletions(-)
> > >>
> > >> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > >> index b1e14be..70294ad 100644
> > >> --- a/drivers/usb/core/hub.c
> > >> +++ b/drivers/usb/core/hub.c
> > >> @@ -1409,13 +1409,11 @@ static int hub_configure(struct usb_hub *hub,
> > >>  		maxchild = min_t(unsigned, maxchild, USB_SS_MAXPORTS);
> > >>  
> > >>  	if (hub->descriptor->bNbrPorts > maxchild) {
> > >> -		message = "hub has too many ports!";
> > >> -		ret = -ENODEV;
> > >> -		goto fail;
> > >> +		dev_info(hub_dev, "hub has too many ports!\n");
> > > 
> > > Is this an error?  If so, report it as such, not as "information".
> > > 
> > >> +		return -ENODEV;
> > >>  	} else if (hub->descriptor->bNbrPorts == 0) {
> > >> -		message = "hub doesn't have any ports!";
> > >> -		ret = -ENODEV;
> > >> -		goto fail;
> > >> +		dev_info(hub_dev, "hub doesn't have any ports!\n");
> > > 
> > > Same here.
> > > 
> > > What problem are you trying to solve here?
> > > 
> > > What hub do you have that has no ports, or too many, that you think
> > > should still be able to work properly?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > > .
> > On our test platform, the xhci usb3 hub has no port.
> 
> Sounds like a broken device, why not fix that?

If this device is used only for testing and not for production, who 
cares how severe the log message is?

> > when initializing the usb3 hub, an error will be reported
> > because the port is 0, but in fact it will not affect
> > the use of usb2, and the usb2 hub is working normally.
> 
> But you can not have a USB3 hub with no ports, isn't that against
> against the USB spec?  How does this device pass the USB-IF
> certification?
> 
> > thanks, therefore, in order to reduce the severity of the log,
> > we hope to lower the level of this log.
> 
> You did not reduce the severity at all, everyone can still see it.
> 
> Please try fixing your hardware :

Alternatively, you could change the xhci-hcd driver.  Make it skip 
registering the USB-3 root hub if that hub has no ports.

But don't change these log messages.  They describe real errors, so they 
should be actual error messages.

Alan Stern

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-25 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 10:04 [RFC PATCH] USB:XHCI:Adjust the log level of hub Longfang Liu
2021-03-25 10:31 ` Greg KH
2021-03-25 13:33   ` liulongfang
2021-03-25 13:59     ` Greg KH
2021-03-25 14:31       ` Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).