On Thu, 24 Sep 2009, Oliver Neukum wrote: > Am Dienstag, 22. September 2009 17:19:53 schrieb Alan Stern: > > > 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. > > OK, I concur we can't do it with a single bit. We at least need a flag > for the shutdown state. But do we really need an initializing state? > It seems to me that we need to solve the initilization problem with > mutual exclusion and no flag can solve the problem. > > The completion handlers care only about an open or closing adapter > as we have no running URBs unless they have been submitted, but > drivers use tasklets which need a flag to safely cancel. You can represent the information any convenient way you like. A flag for "port is running" would be good enough, right? Set the flag before submitting any URBs and clear it before killing the outstanding URBs. The problem with ASYNCB_INITIALIZED is that it doesn't really mean "port is running" -- it means "port is ready to be used". In most drivers the port has to run for a little while (to submit receive URBs) before it can be used. 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