From: Takashi Iwai Subject: Re: Non-atomic code Date: Mon, 27 Feb 2006 12:49:55 +0100 Message-ID: References: <1140981483.9540.28.camel@localhost.localdomain> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <1140981483.9540.28.camel@localhost.localdomain> Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Adrian McMenamin Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Sun, 26 Feb 2006 19:18:03 +0000, Adrian McMenamin wrote: > > Going through other drivers for ideas to write mine I notice lots of > non-atomic code where the instructions say there shouldn't be code that > can sleep eg > > http://sosdg.org/~coywolf/lxr/source/sound/mips/au1x00.c?v=2.6.15#L143 > > which includes: > > kmalloc(sizeof(au1000_period_t), GFP_KERNEL); > > In a function called from the trigger callback. > > How important is it that the code is atomic? it would make my life > easier if it didn't need to be! The atomicity is important as well as the life isn't always easy. The trigger callback is designed basically to be executed immediately (as it name stands). The jobs that may take long time, i.e. setting up the hardware to be ready for start, should be done in prepare callback instead. In your case, the whole au1000_period_t chunk allocations should be moved to prepare callback. Takashi ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642