Skip to contentSkip to conversation

Is the mixer interface in the kernel protect against concurrent access?

DISCUSSION Hans-Christian Egtvedt 2 participants 3 messages Dec 17, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I am solving a locking bug in the at73c213 SPI sound driver, and wondered if the mixer API is protected against concurrent access in ALSA? Or should I implement a mutex to protect my hardware against concurrent access?

Signature · 2 lines
Mvh
Hans-Christian Egtvedt
#1 lore raw
Quoted 6 lines · Hans-Christian Egtvedt

Hi,

I am solving a locking bug in the at73c213 SPI sound driver, and wondered if the mixer API is protected against concurrent access in ALSA? Or should I implement a mutex to protect my hardware against concurrent access?

Control r/w callbacks are protected with a semaphore - card->controls_rwsem . See sound/core/control.c for more details. Anyway, you need to protect your registers with spinlocks (if required of course).

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project

#2 lore raw
Quoted 11 lines · Jaroslav Kysela
Quoted 4 lines · Hans-Christian Egtvedt

I am solving a locking bug in the at73c213 SPI sound driver, and wondered if the mixer API is protected against concurrent access in ALSA? Or should I implement a mutex to protect my hardware against concurrent access?

Control r/w callbacks are protected with a semaphore - card->controls_rwsem . See sound/core/control.c for more details. Anyway, you need to protect your registers with spinlocks (if required of course).

Thanks for the feedback. I settled upon a mutex since the SPI driver can not use spinlocks due to a might sleepy spi_sync function call.

Signature · 2 lines
Mvh
Hans-Christian Egtvedt