On Thu, 8 Jan 2004, David Brownell wrote:

> Oliver Neukum wrote:
> > 
> > Yes, that is true. But, maybe I am dense, but why can't this be done
> > by making state atomic or protect it by a spinlock?
> 
> Not dense ... but you do seem to have overlooked the (earlier) part
> of that note which said:
> 
> >> Maybe having a spinlock protect dev->state transitions would be
> >> workable, but it'd likely be a larger patch.
> 
> "Atomic" might work too, except that the value is an enum not
> an integer so there'd be some type punning in the atomic_set()
> and atomic_read() calls.

Actually, making state atomic probably won't work.  It doesn't resolve 
such problems as usb_disconnect() setting state to NOTATTACHED just before 
usb_set_configuration() sets it to CONFIGURED.

Using a spinlock would be the conventional way to do it.  It wouldn't be 
that much more work because there are only a few places where the state 
changes after usb_new_device() runs.

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to