Skip to content

Commit

Permalink
ALSA: hda: take cmd_mutex in probe_codec()
Browse files Browse the repository at this point in the history
Now that each codec will have its own module, it is possible
for the user to load one codec while another one is running.

So cmd_mutex would be a safe addition to probe_codec().

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Wu Fengguang authored and Takashi Iwai committed Aug 3, 2009
1 parent deadff1 commit a678cde
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,10 +1275,12 @@ static int probe_codec(struct azx *chip, int addr)
(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
unsigned int res;

mutex_lock(&chip->bus->cmd_mutex);
chip->probing = 1;
azx_send_cmd(chip->bus, cmd);
res = azx_get_response(chip->bus, addr);
chip->probing = 0;
mutex_unlock(&chip->bus->cmd_mutex);
if (res == -1)
return -EIO;
snd_printdd(SFX "codec #%d probed OK\n", addr);
Expand Down

0 comments on commit a678cde

Please sign in to comment.