On Tue, 14 Mar 2006, Alan Stern wrote:

> > > acm_tty_close tty=cd254af8 filp=ce96511c acm=ce24eca0
> > > acm_tty_close acm->used=1 acm->dev=00000000
> > atm_tty_close called from tty_io.c:release_dev()
> > acm->used=1 on entry, decrements to zero == final close
> > acm->dev is NULL (unplugged) so call tty_unregister_device()
> 
> The disconnect routine shouldn't need to set acm->dev to NULL.  The fact
> that the first disconnect has already occurred can be detected by the fact
> that acm = usb_get_intfdata(intf) will itself be NULL.
> 
> Will everything work if you simply delete the line
> 
>       acm->dev = NULL;
> 
> from acm_disconnect()?

After looking at the code, I see that it won't.  The acm_tty_close() 
routine uses acm->dev to tell whether or not the USB device has been 
disconnected.  The problem is that when acm->dev is NULL, it calls 
acm_tty_unregister() which requires acm->dev to be non-NULL.

So the answer is simple: acm_tty_close() needs to use something else 
instead.  There needs to be an additional flag added to struct acm to 
indicate that the USB device has been disconnected.  acm_tty_close() 
should test this new flag instead of testing acm->dev, and 
acm_disconnect() should set this flag instead of clearing acm->dev.

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