Re: [RFC PATCH] USB:XHCI:skip hub registration

From: Alan Stern
Date: Sat Apr 17 2021 - 11:31:09 EST

On Sat, Apr 17, 2021 at 02:48:22PM +0800, liulongfang wrote:
> On 2021/4/16 23:20, Alan Stern wrote:
> > On Fri, Apr 16, 2021 at 10:03:21AM +0800, liulongfang wrote:
> >> The current method is an improved method of the above patch.
> >> This patch just make it skip registering USB-3 root hub if that hub has no ports,
> >
> > No, that isn't what this patch does.
> >
> > If the root hub wasn't registered, hub_probe wouldn't get called. But
> > with your patch, the system tries to register the root hub, and it does
> > call hub_probe, and then that function fails with a warning message.
> >
> > The way to _really_ akip registering the root hub is to change the
> > xhci-hcd code. Make it skip calling usb_add_hcd.
> >
> If you do not register in the root hub, this will return an error code,

What will return an error code? Are you talking about xhci_pci_probe()?
You oight to be able to figure out how to make it work.

> which will make all the XHCI drivers unregister, causing the USB2.0 controllers
> on the xhci to be unavailable.

Alan Stern