lkml.org 
[lkml]   [2015]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH v2 06/13] usb: hcd: Add hcd add/remove functions for OTG use
On Fri, 17 Apr 2015, Roger Quadros wrote:

> On 17/04/15 05:18, Peter Chen wrote:
> > On Tue, Apr 14, 2015 at 01:41:53PM +0300, Roger Quadros wrote:
> >> The existing usb_add/remove_hcd() functionality
> >> remains unchanged for non-OTG devices. For OTG
> >> devices they only register the HCD with the OTG core.
> >>
> >> Introduce _usb_add/remove_hcd() for use by OTG core.
> >> These functions actually add/remove the HCD.
> >
> > Would you please explain why additional _usb_add/remove_hcd are needed?
>
> It is to differentiate if the add/remove_hcd was called by the
> HCD drivers or by the OTG core as we want to behave a bit differently
> in both cases.
> When called by HCD drivers, we want to defer the add/remove if it is an
> OTG device. When called by OTG core, we don't want to defer the add/remove.

I don't understand this. Why do you want to defer the add/remove if
the device is OTG? Don't host controller drivers expect these things
to execute synchronously?

For example, what happens if you rmmod the HCD? If the remove call
gets deferred, then when it finally runs it will try to call back into
HCD code that has already been unloaded from memory!

> HCD drivers use usb_add/remove_hcd()
> OTG core uses _usb_add/remove_hcd()

How about a more explicit naming scheme?

HC drivers use usb_add/remove_hcd()
OTG core uses usb_otg_add/remove_hcd()

Alan Stern



\
 
 \ /
  Last update: 2015-04-17 16:21    [W:0.181 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site