Date: Mon, 19 Jun 2006 13:46:48 +0200 From: Hans Petter Selasky <hselasky@c2i.net> To: freebsd-multimedia@freebsd.org Subject: Complaints about the sound system with regard to USB Message-ID: <200606191346.48853.hselasky@c2i.net>
next in thread | raw e-mail | index | archive | help
Hi,
I have some complaints about the sound system with regard to USB.
1) If you are playing sound, and unplug the sound device, the system is going 
to come down with a panic, hence "pcm_unregister()" returns EBUSY, and that 
is not allowed when a USB device is detached.
2) The locking system is not right. Why must the sound device driver unlock 
its private lock before calling "chn_intr()" ? I see why, because else you 
get a dead lock:
   if (ch->run) {
    ICH_UNLOCK(sc);
    chn_intr(ch->channel);
    ICH_LOCK(sc);
   }
Solution:
1) It is not impossible to kill opened devices at detach.
2) Please use only one lock per "sound-controller". All "child" structures 
should be protected by this lock, PCM, MIDI, whatever. And when you call up, 
lock this lock before doing the call, ala CHN_LOCK(). And when you call down, 
this lock should already be locked.
/*---------------------------------------------------------------------------*
 *      pcm_controller_allocate
 *
 * NOTE: all sub-controllers are under the same lock!
 *---------------------------------------------------------------------------*/
struct pcm_controller *
pcm_controller_allocate(u_int8_t portable, u_int8_t sub_controllers)
Any comments?
--HPS
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606191346.48853.hselasky>
