Am Dienstag, 22. September 2009 12:31:01 schrieb Alan Cox: > > Any other suggestions? > > For those cases the last set of patches merged added > > extern inline int tty_port_users(struct tty_port *port) > { > return port->count + port->blocked_open; > } > > however using that without care (eg without holding the port lock) will 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. > leave races. There is of course no reason the USB layer shouldn't either > keep another flag that indicates what USB needs to know or just adjust > where it sets ASYNCB_INITIALIZED. > > However - you need to think hard about what the rules are for the URB > retransmission versus a parallel hangup/close/open sequence. Trying to do > it in the interrupt handler seems rather bogus when the URB could be > cancelled in the close down call ? As long as an URB resubmits only itself that is safe, because in the close down call usb_kill_urb() is used which prevents a resubmission. If a completion handler submits another URB, as at least one driver does, things get hairy. It seems to me that you best set a flag for an ongoing closure for these drivers. In fact for the common case it would be simplest but brutal to unconditionally resubmit and be prepared to deal with -EPERM returned from usb_submit_urb() Regards Oliver -- 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