Skip to contentSkip to conversation

Non-atomic code

DISCUSSION Adrian McMenamin 2 participants 2 messages Feb 26, 2006 – Feb 27, 2006

lore
Share & tools
lore
#0 lore raw

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!

-------------------------------------------------------
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

#1 lore raw

At Sun, 26 Feb 2006 19:18:03 +0000,

Quoted 7 lines · Adrian McMenamin

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

Quoted 8 lines

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