Skip to content

Commit befceea

Browse files
tiwaiperexg
authored andcommitted
[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>
1 parent e3cde64 commit befceea

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎sound/pci/echoaudio/echoaudio.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ static int pcm_digital_in_open(struct snd_pcm_substream *substream)
378378

379379
DE_ACT(("pcm_digital_in_open\n"));
380380
max_channels = num_digital_busses_in(chip) - substream->number;
381-
down(&chip->mode_mutex);
381+
mutex_lock(&chip->mode_mutex);
382382
if (chip->digital_mode == DIGITAL_MODE_ADAT)
383383
err = pcm_open(substream, max_channels);
384384
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)
405405
chip->can_set_rate=0;
406406

407407
din_exit:
408-
up(&chip->mode_mutex);
408+
mutex_unlock(&chip->mode_mutex);
409409
return err;
410410
}
411411

@@ -420,7 +420,7 @@ static int pcm_digital_out_open(struct snd_pcm_substream *substream)
420420

421421
DE_ACT(("pcm_digital_out_open\n"));
422422
max_channels = num_digital_busses_out(chip) - substream->number;
423-
down(&chip->mode_mutex);
423+
mutex_lock(&chip->mode_mutex);
424424
if (chip->digital_mode == DIGITAL_MODE_ADAT)
425425
err = pcm_open(substream, max_channels);
426426
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)
447447
if (atomic_read(&chip->opencount) > 1 && chip->rate_set)
448448
chip->can_set_rate=0;
449449
dout_exit:
450-
up(&chip->mode_mutex);
450+
mutex_unlock(&chip->mode_mutex);
451451
return err;
452452
}
453453

@@ -1420,7 +1420,7 @@ static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
14201420
if (dmode != chip->digital_mode) {
14211421
/* mode_mutex is required to make this operation atomic wrt
14221422
pcm_digital_*_open() and set_input_clock() functions. */
1423-
down(&chip->mode_mutex);
1423+
mutex_lock(&chip->mode_mutex);
14241424

14251425
/* Do not allow the user to change the digital mode when a pcm
14261426
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,
14391439
if (changed >= 0)
14401440
changed = 1; /* No errors */
14411441
}
1442-
up(&chip->mode_mutex);
1442+
mutex_unlock(&chip->mode_mutex);
14431443
}
14441444
return changed;
14451445
}
@@ -1566,12 +1566,12 @@ static int snd_echo_clock_source_put(struct snd_kcontrol *kcontrol,
15661566
return -EINVAL;
15671567
dclock = chip->clock_source_list[eclock];
15681568
if (chip->input_clock != dclock) {
1569-
down(&chip->mode_mutex);
1569+
mutex_lock(&chip->mode_mutex);
15701570
spin_lock_irq(&chip->lock);
15711571
if ((changed = set_input_clock(chip, dclock)) == 0)
15721572
changed = 1; /* no errors */
15731573
spin_unlock_irq(&chip->lock);
1574-
up(&chip->mode_mutex);
1574+
mutex_unlock(&chip->mode_mutex);
15751575
}
15761576

15771577
if (changed < 0)
@@ -1972,7 +1972,7 @@ static __devinit int snd_echo_create(struct snd_card *card,
19721972
return err;
19731973
}
19741974
atomic_set(&chip->opencount, 0);
1975-
init_MUTEX(&chip->mode_mutex);
1975+
mutex_init(&chip->mode_mutex);
19761976
chip->can_set_rate = 1;
19771977
*rchip = chip;
19781978
/* Init done ! */

‎sound/pci/echoaudio/echoaudio.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ struct echoaudio {
361361
spinlock_t lock;
362362
struct snd_pcm_substream *substream[DSP_MAXPIPES];
363363
int last_period[DSP_MAXPIPES];
364-
struct semaphore mode_mutex;
364+
struct mutex mode_mutex;
365365
u16 num_digital_modes, digital_mode_list[6];
366366
u16 num_clock_sources, clock_source_list[10];
367367
atomic_t opencount;

0 commit comments

Comments
 (0)