ALSA: ak411x: Fix race of reinit() calls

Protect the call with a mutex, as this may be called in parallel
(either from the PCM rate change and the clock change).

Acked-by: Jaroslav Kysela <[email protected]>
Tested-by: Pavel Hofman <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
This commit is contained in:
Takashi Iwai 2015-01-16 13:03:28 +01:00
commit 1781e78c63
4 changed files with 8 additions and 0 deletions

View file

@ -287,6 +287,7 @@ struct ak4113 {
ak4113_read_t *read;
void *private_data;
atomic_t wq_processing;
struct mutex reinit_mutex;
spinlock_t lock;
unsigned char regmap[AK4113_WRITABLE_REGS];
struct snd_kcontrol *kctls[AK4113_CONTROLS];

View file

@ -169,6 +169,7 @@ struct ak4114 {
ak4114_read_t * read;
void * private_data;
atomic_t wq_processing;
struct mutex reinit_mutex;
spinlock_t lock;
unsigned char regmap[6];
unsigned char txcsb[5];