On Friday 18 August 2006 11:58 am, Alan Stern wrote:
> On Fri, 18 Aug 2006, David Brownell wrote:
> 
> > On Friday 18 August 2006 9:28 am, Alan Stern wrote:
> > 
> > > The one interesting aspect is that the dev_set_drvdata calls were
> > > moved from the usb_create_hcd and usb_put_hcd routines, where they
> > > clearly don't belong, into usb_add_hcd and usb_remove_hcd.  This
> > > shouldn't cause any problems.
> > 
> > Actually it'd be best to not do that. ...
> 
> Then you're saying that although it won't cause any problems currently, it 
> would make things difficult in the future or for out-of-tree drivers.

It causes problems for a driver that's currently out-of-tree but which
is nearly ready to be circulated ... _and_ is not a good change.


> > If they "clearly don't belong", it would be because the driver itself,
> > rather than the glue layer, ought to control that driver data field.
> 
> I'll buy that.
> 
> > For example, by pointing to the driver-private structure used to manage
> > both roles (host, peripheral), rather than a usbcore structure that's
> > irrelevant if usbcore isn't configured (e.g. a peripheral-only board).
> > But I don't see that as currently being practical.  So meanwhile,
> > please leave that part of the setup/create logic as-is.
> 
> The thing is, they _can't_ be left where they are.  usb_put_hcd can be 
> called an arbitrarily large number of times (provided it's balanced by an 
> equal number of calls to usb_get_hcd) while the driver is still running.  
> We can't have it setting the driver data to NULL.  The only reason it has 
> worked up until now is that there hasn't been any usb_get_hcd!  But the 
> patch adds one, and it is used in a few places.
> 
> In principle the call in usb_create_hcd could stay where it is.  But it
> would need to get undone somehow -- where should that happen?

Driver data is undefined when no driver is bound; it doesn't actually
need to be nulled out...


> Maybe it would be best to precede this patch with another one that moves 
> all those set_drvdata calls into the individual drivers and out of the 
> core.

There's a patch now in Greg's queue which relies on the drvdata to be
the HCD (it's the shutdown patch).

- Dave


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to