aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/echoaudio
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-12-03 11:08:40 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:31 -0500
commitbefceea90b17792cb03cc4e22f3329c89621bba3 (patch)
tree792c6ceb965e9c522d0847a1d2d53d48aed7fc4d /sound/pci/echoaudio
parente3cde64af44624030e7635881a5d1932c353a335 (diff)
[ALSA] echoaudio - convert from semaphore to mutex
Converted from semaphore to mutex. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/echoaudio')
-rw-r--r--sound/pci/echoaudio/echoaudio.c18
-rw-r--r--sound/pci/echoaudio/echoaudio.h2
2 files changed, 10 insertions, 10 deletions
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 499ee1a5319d..90ec090792ba 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -378,7 +378,7 @@ static int pcm_digital_in_open(struct snd_pcm_substream *substream)
378 378
379 DE_ACT(("pcm_digital_in_open\n")); 379 DE_ACT(("pcm_digital_in_open\n"));
380 max_channels = num_digital_busses_in(chip) - substream->number; 380 max_channels = num_digital_busses_in(chip) - substream->number;
381 down(&chip->mode_mutex); 381 mutex_lock(&chip->mode_mutex);
382 if (chip->digital_mode == DIGITAL_MODE_ADAT) 382 if (chip->digital_mode == DIGITAL_MODE_ADAT)
383 err = pcm_open(substream, max_channels); 383 err = pcm_open(substream, max_channels);
384 else /* If the card has ADAT, subtract the 6 channels 384 else /* If the card has ADAT, subtract the 6 channels
@@ -405,7 +405,7 @@ static int pcm_digital_in_open(struct snd_pcm_substream *substream)
405 chip->can_set_rate=0; 405 chip->can_set_rate=0;
406 406
407din_exit: 407din_exit:
408 up(&chip->mode_mutex); 408 mutex_unlock(&chip->mode_mutex);
409 return err; 409 return err;
410} 410}
411 411
@@ -420,7 +420,7 @@ static int pcm_digital_out_open(struct snd_pcm_substream *substream)
420 420
421 DE_ACT(("pcm_digital_out_open\n")); 421 DE_ACT(("pcm_digital_out_open\n"));
422 max_channels = num_digital_busses_out(chip) - substream->number; 422 max_channels = num_digital_busses_out(chip) - substream->number;
423 down(&chip->mode_mutex); 423 mutex_lock(&chip->mode_mutex);
424 if (chip->digital_mode == DIGITAL_MODE_ADAT) 424 if (chip->digital_mode == DIGITAL_MODE_ADAT)
425 err = pcm_open(substream, max_channels); 425 err = pcm_open(substream, max_channels);
426 else /* If the card has ADAT, subtract the 6 channels 426 else /* If the card has ADAT, subtract the 6 channels
@@ -447,7 +447,7 @@ static int pcm_digital_out_open(struct snd_pcm_substream *substream)
447 if (atomic_read(&chip->opencount) > 1 && chip->rate_set) 447 if (atomic_read(&chip->opencount) > 1 && chip->rate_set)
448 chip->can_set_rate=0; 448 chip->can_set_rate=0;
449dout_exit: 449dout_exit:
450 up(&chip->mode_mutex); 450 mutex_unlock(&chip->mode_mutex);
451 return err; 451 return err;
452} 452}
453 453
@@ -1420,7 +1420,7 @@ static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
1420 if (dmode != chip->digital_mode) { 1420 if (dmode != chip->digital_mode) {
1421 /* mode_mutex is required to make this operation atomic wrt 1421 /* mode_mutex is required to make this operation atomic wrt
1422 pcm_digital_*_open() and set_input_clock() functions. */ 1422 pcm_digital_*_open() and set_input_clock() functions. */
1423 down(&chip->mode_mutex); 1423 mutex_lock(&chip->mode_mutex);
1424 1424
1425 /* Do not allow the user to change the digital mode when a pcm 1425 /* Do not allow the user to change the digital mode when a pcm
1426 device is open because it also changes the number of channels 1426 device is open because it also changes the number of channels
@@ -1439,7 +1439,7 @@ static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
1439 if (changed >= 0) 1439 if (changed >= 0)
1440 changed = 1; /* No errors */ 1440 changed = 1; /* No errors */
1441 } 1441 }
1442 up(&chip->mode_mutex); 1442 mutex_unlock(&chip->mode_mutex);
1443 } 1443 }
1444 return changed; 1444 return changed;
1445} 1445}
@@ -1566,12 +1566,12 @@ static int snd_echo_clock_source_put(struct snd_kcontrol *kcontrol,
1566 return -EINVAL; 1566 return -EINVAL;
1567 dclock = chip->clock_source_list[eclock]; 1567 dclock = chip->clock_source_list[eclock];
1568 if (chip->input_clock != dclock) { 1568 if (chip->input_clock != dclock) {
1569 down(&chip->mode_mutex); 1569 mutex_lock(&chip->mode_mutex);
1570 spin_lock_irq(&chip->lock); 1570 spin_lock_irq(&chip->lock);
1571 if ((changed = set_input_clock(chip, dclock)) == 0) 1571 if ((changed = set_input_clock(chip, dclock)) == 0)
1572 changed = 1; /* no errors */ 1572 changed = 1; /* no errors */
1573 spin_unlock_irq(&chip->lock); 1573 spin_unlock_irq(&chip->lock);
1574 up(&chip->mode_mutex); 1574 mutex_unlock(&chip->mode_mutex);
1575 } 1575 }
1576 1576
1577 if (changed < 0) 1577 if (changed < 0)
@@ -1972,7 +1972,7 @@ static __devinit int snd_echo_create(struct snd_card *card,
1972 return err; 1972 return err;
1973 } 1973 }
1974 atomic_set(&chip->opencount, 0); 1974 atomic_set(&chip->opencount, 0);
1975 init_MUTEX(&chip->mode_mutex); 1975 mutex_init(&chip->mode_mutex);
1976 chip->can_set_rate = 1; 1976 chip->can_set_rate = 1;
1977 *rchip = chip; 1977 *rchip = chip;
1978 /* Init done ! */ 1978 /* Init done ! */
diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h
index 7e88c968e22f..1c88e051abf2 100644
--- a/sound/pci/echoaudio/echoaudio.h
+++ b/sound/pci/echoaudio/echoaudio.h
@@ -361,7 +361,7 @@ struct echoaudio {
361 spinlock_t lock; 361 spinlock_t lock;
362 struct snd_pcm_substream *substream[DSP_MAXPIPES]; 362 struct snd_pcm_substream *substream[DSP_MAXPIPES];
363 int last_period[DSP_MAXPIPES]; 363 int last_period[DSP_MAXPIPES];
364 struct semaphore mode_mutex; 364 struct mutex mode_mutex;
365 u16 num_digital_modes, digital_mode_list[6]; 365 u16 num_digital_modes, digital_mode_list[6];
366 u16 num_clock_sources, clock_source_list[10]; 366 u16 num_clock_sources, clock_source_list[10];
367 atomic_t opencount; 367 atomic_t opencount;