On Fri, 16 Sep 2005, Greg KH wrote:

> > Your usb_{create|remove}_intf_ep_files routines are called whenever
> > interfaces are created or destroyed.  But you also need to call them
> > whenever an altsetting is changed. 
> 
> Hm, where is that?  ugh, I'll go dig...

It's a bit of a mess.  All the relevant stuff is in message.c, and most of
the work can probably be done in usb_enable_interface and
usb_disable_interface.  But in usb_disable_device and
usb_reset_configuration, _all_ the endpoints get turned off (or all but
ep0) -- so those routines don't call usb_disable_interface but simply loop
over all the endpoints.

> > Which causes difficulties, because in usb_remove_ep_files, it will no
> > longer be safe to kfree all those data structures. 
> 
> Why not?  Those structures are only tied directly to the sysfs
> representation of the endpoint.  If they go away, the memory should be
> freed.

Because a user process might be holding the attribute file open when the 
altsetting is changed.  The change will take effect immediately; it won't 
wait for the user to close the file.  So you'd be freeing memory that's 
still being used by the open file.

Alan Stern



-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to