On Tue, 22 Sep 2009, Alan Cox wrote: > > This makes it hard to use for USB drivers. The need to hold a mutex > > was the precise reason the sierra driver got the opened flag protected > > with a spinlock. > > The problem is that it isn't a meaningful question to ask in many ways > because you can get an IRQ while opening while closing, or indeed if a > CPU is stalled by something a close and reopen on one CPU while the other > handles the IRQ event. While different CPUs can have different views of the various tty states, and while there can be more than one open file reference or (possibly) tty in existence at a time, nevertheless the hardware is unique and can be in only one state at a given time. > The same in many ways is true of ASYNCB_INITIALIZED - a valid answer to > the mid IRQ question of "are we open at the moment" is "yes, no, yes, no, > yes, no" - so there has to be serialization or it has to be handled in a > more logical place. The real problem here is that the hardware is actually a four-state system: off, initializing, running, shutting down. Hence a one-bit flag isn't sufficient to represent all the possible states. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html