From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D3B1C433DB for ; Thu, 25 Mar 2021 14:31:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60B4A619B6 for ; Thu, 25 Mar 2021 14:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231208AbhCYObT (ORCPT ); Thu, 25 Mar 2021 10:31:19 -0400 Received: from netrider.rowland.org ([192.131.102.5]:46117 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S231435AbhCYObG (ORCPT ); Thu, 25 Mar 2021 10:31:06 -0400 Received: (qmail 788278 invoked by uid 1000); 25 Mar 2021 10:31:04 -0400 Date: Thu, 25 Mar 2021 10:31:04 -0400 From: Alan Stern To: Greg KH Cc: liulongfang , mathias.nyman@intel.com, linux-usb@vger.kernel.org, yisen.zhuang@huawei.com, tanxiaofei@huawei.com, liudongdong3@huawei.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] USB:XHCI:Adjust the log level of hub Message-ID: <20210325143104.GA785961@rowland.harvard.edu> References: <1616666652-37920-1-git-send-email-liulongfang@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 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 > > >> --- > > >> 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