Apparently, my earlier reply was lost, trying again:

> 2. You must not do IO after returning from
> disconnect

Does usb_kill_urb count as "IO"?
Many drivers call it from their shutdown routines,
which may be called after disconnect.


> It is perfectly valid to do (in pseudocode)
> 
> disconnect:
> lock()
> device->disconnect_flag = 1;
> unlock()
> rest()
> put()
> 
> io-method:
> lock()
> if (device->disconnect_flag)
>  goto err_no_dev;
> io()
> unlock()
> 

Yes, this is similar to the mutex, which you added in
your earlier patch. My concern is that calling
external functions, such as shutdown, may cause
a deadlock if any of them will synchronize with TTY
stack. 

I think that safer way to use a lock or a mutex
is to protect short pieces of code, such as 
usb_serial_get_by_index or get_free_serial.

John



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
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