Qiao Zhou wrote: > when usb audio device removes, it doesn't notify the ALSA read / > write thread. due to no data transmitting any more, those threads > wait for a long timeout(10s), then detects IO error. it causes > long time blocking in upper layer read/write. > > to fix this issue, wake up potential sleep thread if necessary > when audio unbind. > + if (substream && substream->runtime && substream->runtime->twake) > + wake_up(&substream->runtime->tsleep); The PCM stream should be properly stopped, which automatically takes care of notifying userspace. See this code for an example: <http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/staging/line6/pcm.c?id=86f0b5b86d142b9323432fef078a6cf0fb5dda74#n392> > substream & pcm may still be used after audio unbind, and we > should only set null to it in audio_pcm_close. What happens when the application immediately tries to restart the stream? Many USB audio drivers set a "disconnected" flag to prevent this, but I don't know if the gadget driver has races that would require such a check. Regards, Clemens -- 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