On Wed, 15 Mar 2006, Greg KH wrote:

> > (It wouldn't be a bad idea to set dev->kobj->dentry to NULL as soon as the
> > dentry is deallocated anyway.  Doing that would make bugs a little easier
> > to spot.)
> 
> Due to the way that sysfs rebuilds dentrys and inodes on the fly after
> memory pressure pushes them out of the cache, it might be tougher to do
> this than you might originally think :)

I'll leave the implementation details up to you.  :-)

> > You know, another possibility is that cdc_acm should call
> > tty_unregister_device as soon as the USB device is disconnected.  It would
> > make sense; no point leaving a tty visible in sysfs if it's no longer
> > accessible (except through already-opened file descriptors). However I
> > don't know whether the tty subsystem is designed to work that way.
> 
> No, do that on the last close, the disconnect should call hangup which
> will allow the userspace code to properly drop the device and then the
> tty layer can be shutdown easily.
> 
> The tty layer is _not_ very good at handling dynamic devices, so you
> need to be very careful with this.
> 
> I still think it's easier to reference count the whole object, but then
> hey, what do I know... :)

Isn't acm->used essentially a reference count already?  Just change it 
from unsigned int to struct kref.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&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