On Fri, 14 Jun 2013, Sarah Sharp wrote:

> On Wed, Jun 12, 2013 at 07:11:22PM +0300, Mathias Nyman wrote:
> > Hi
> > 
> > This is a proposal for simplifying the EHCI/xHCI portswitching
> > 
> > It's a lot simpler than before. There's now only one funtion for enabling 
> > xhci ports,
> > and we only once walk through pci devices to find Intel EHCI and xHCI 
> > controllers
> > 
> > In pci-quirks we set a flag if both intel xHCI and EHCI controllers are 
> > found,
> > and then call the usb_enable_intel_xhci_ports() function.
> > EHCI and xHCI resume functions call the same usb_enable_intel_xhci_ports(), 
> > without
> > walking the pci devices.
> > 
> > On the downside this uses global variables, one xhci pointer and one 
> > boolean flag.
> > The xhci pointer is set only once in pci-quirk and it's assumed that xHCI 
> > device is not removed,
> > so there's a possibility this pointer can go stale. 
> > Also we can only handle one Intel xHCI host in the system.
> > 
> > I'll gladly rework this to remove the global varaibles, but I could use 
> > some input on what would be
> > the right way to do it. I can only come up with two options:
> > 
> > 1. walk the pci devices every time in ECHI and xHCI resume functions and 
> > search for a "companion"
> > controller.
> > 
> > or
> > 
> > 2. Save a pointer to a "companion" xHCI controller somewhere in EHCI 
> > structures, and vice versa.
> > (or somehow re-use the hs_companion pointer in struct usb_bus). 
> > Those pointers can only be set after hcd's are initialized, so we need to 
> > walk the pci devices once in
> > pci-quirks, and once later when creating the hcd's to set the pointers
> 
> I think this approach is better, but I want Alan's opinion on it.  Alan?

I don't have a copy of the original patch handy, so I'll have to get 
back to you on this.

However, since this code will run only during controller probing and
resume (IIUC), it doesn't have to be extremely fast.  Iterating through
all the PCI devices seems acceptable, especially if doing it that way
can avoid problems with hotplugging, driver removal, or multiple xHCI 
controllers.  With a little extra work, it should be possible to do 
this only once during each system resume, rather than once for each 
controller.  Right?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to