Re: [PATCH v4 1/2] dt-bindings: usb: Add binding for discrete onboard USB hubs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 07, 2020 at 02:42:26PM -0700, Matthias Kaehlcke wrote:
> On Wed, Oct 07, 2020 at 04:17:32PM -0400, Alan Stern wrote:
> > The peering relation goes both ways, so it should be included in the 
> > hub_2_0 description too.  Given that, the driver could check hub_2_0's 
> > peer's DT description for the appropriate resources.
> 
> That mitigates the issue somewhat, however we still have to convince Rob that
> both references are needed.

Strictly speaking, the peering relation applies to ports, not
devices.  The representation in DT doesn't have to be symmetrical; as
long as the kernel understands it, the kernel can set up its own
internal symmetrical respresentation.

> > > All this mess can be avoided by having a single instance in control of the
> > > resources which is guaranteed to suspend after the USB devices.
> > 
> > Yes.  At the cost of registering, adding a driver for, and making users 
> > aware of a fictitious platform device.
> 
> Registration is trivial and the driver code will be needed anyway, I'm
> pretty convinced that a separate platform driver will be simpler than
> plumbing things into the hub driver, with the additional checks of who is
> suspended or not, etc. If other resources like resets are involved there
> could be further possible race conditions at probe time. Another issue is
> the sysfs attribute. We said to attach it to the primary hub. What happens
> when the primary hub goes away? I guess we could force unbinding the peers
> as we did in the driver under discussion to avoid confusion/inconsistencies,
> but it's another tradeoff.
> 
> My view of the pros and cons of extending the hub driver vs. having a platform
> driver:
> 
> - pros
>   - sysfs attribute is attached to a USB hub device
>   - no need to register a platform device (trivial)
>   - potentially more USB awareness (not clear if needed)
> 
> - cons
>   - possible races involving resources between peer hubs during initialization
>   - increased complexity from keeping track of peers, checking suspend order
>     and avoiding races
>   - peers are forced to unbind when primary goes away
>   - need DT links to peers for all USB hubs, not only in the primary
>   - pollution of the generic hub code with device specific stuff instead
>     of keeping it in a self contained driver
>   - sysfs attribute is attached to only one of the hubs, which is better than
>     having it on both, but not necessarily better than attaching it to the
>     platform device with the 'control logic'
> 
> So yes, there are tradeoffs, IMO balance isn't as clear as your comment
> suggests.

Well, I guess I'm okay with either approach.

One more thing to keep in mind, though: With the platform device,
there should be symlinks from the hubs' sysfs directories to the
platform device (and possibly symlinks going the other way as well).

Alan Stern



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux