Skip to content

Commit 8b7547f

Browse files
Ingo MolnarJaroslav Kysela
authored andcommitted
[ALSA] semaphore -> mutex (ISA part)
Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ef9f0a4 commit 8b7547f

12 files changed

Lines changed: 57 additions & 57 deletions

File tree

‎include/sound/ad1848.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ struct snd_ad1848 {
154154
#endif
155155

156156
spinlock_t reg_lock;
157-
struct semaphore open_mutex;
157+
struct mutex open_mutex;
158158
};
159159

160160
/* exported functions */

‎include/sound/cs4231.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ struct snd_cs4231 {
248248
unsigned int c_dma_size;
249249

250250
spinlock_t reg_lock;
251-
struct semaphore mce_mutex;
252-
struct semaphore open_mutex;
251+
struct mutex mce_mutex;
252+
struct mutex open_mutex;
253253

254254
int (*rate_constraint) (struct snd_pcm_runtime *runtime);
255255
void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);

‎include/sound/gus.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ struct snd_gf1_mem {
209209
struct snd_gf1_bank_info banks_16[4];
210210
struct snd_gf1_mem_block *first;
211211
struct snd_gf1_mem_block *last;
212-
struct semaphore memory_mutex;
212+
struct mutex memory_mutex;
213213
};
214214

215215
struct snd_gf1_dma_block {
@@ -467,8 +467,8 @@ struct snd_gus_card {
467467
spinlock_t dma_lock;
468468
spinlock_t pcm_volume_level_lock;
469469
spinlock_t uart_cmd_lock;
470-
struct semaphore dma_mutex;
471-
struct semaphore register_mutex;
470+
struct mutex dma_mutex;
471+
struct mutex register_mutex;
472472
};
473473

474474
/* I/O functions for GF1/InterWave chip - gus_io.c */

‎include/sound/sb16_csp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct snd_sb_csp {
158158
struct snd_kcontrol *qsound_switch;
159159
struct snd_kcontrol *qsound_space;
160160

161-
struct semaphore access_mutex; /* locking */
161+
struct mutex access_mutex; /* locking */
162162
};
163163

164164
int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);

‎sound/isa/ad1848/ad1848_lib.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
387387
{
388388
unsigned long flags;
389389

390-
down(&chip->open_mutex);
390+
mutex_lock(&chip->open_mutex);
391391
if (chip->mode & AD1848_MODE_OPEN) {
392-
up(&chip->open_mutex);
392+
mutex_unlock(&chip->open_mutex);
393393
return -EAGAIN;
394394
}
395395
snd_ad1848_mce_down(chip);
@@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode)
432432
spin_unlock_irqrestore(&chip->reg_lock, flags);
433433

434434
chip->mode = mode;
435-
up(&chip->open_mutex);
435+
mutex_unlock(&chip->open_mutex);
436436

437437
return 0;
438438
}
@@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
441441
{
442442
unsigned long flags;
443443

444-
down(&chip->open_mutex);
444+
mutex_lock(&chip->open_mutex);
445445
if (!chip->mode) {
446-
up(&chip->open_mutex);
446+
mutex_unlock(&chip->open_mutex);
447447
return;
448448
}
449449
/* disable IRQ */
@@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip)
471471
spin_unlock_irqrestore(&chip->reg_lock, flags);
472472

473473
chip->mode = 0;
474-
up(&chip->open_mutex);
474+
mutex_unlock(&chip->open_mutex);
475475
}
476476

477477
/*
@@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card,
889889
if (chip == NULL)
890890
return -ENOMEM;
891891
spin_lock_init(&chip->reg_lock);
892-
init_MUTEX(&chip->open_mutex);
892+
mutex_init(&chip->open_mutex);
893893
chip->card = card;
894894
chip->port = port;
895895
chip->irq = -1;

‎sound/isa/cs423x/cs4231_lib.c‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
531531
unsigned long flags;
532532
int full_calib = 1;
533533

534-
down(&chip->mce_mutex);
534+
mutex_lock(&chip->mce_mutex);
535535
snd_cs4231_calibrate_mute(chip, 1);
536536
if (chip->hardware == CS4231_HW_CS4231A ||
537537
(chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip,
560560
snd_cs4231_mce_down(chip);
561561
}
562562
snd_cs4231_calibrate_mute(chip, 0);
563-
up(&chip->mce_mutex);
563+
mutex_unlock(&chip->mce_mutex);
564564
}
565565

566566
static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
@@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
570570
unsigned long flags;
571571
int full_calib = 1;
572572

573-
down(&chip->mce_mutex);
573+
mutex_lock(&chip->mce_mutex);
574574
snd_cs4231_calibrate_mute(chip, 1);
575575
if (chip->hardware == CS4231_HW_CS4231A ||
576576
(chip->hardware & CS4231_HW_CS4232_MASK)) {
@@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip,
603603
snd_cs4231_mce_down(chip);
604604
}
605605
snd_cs4231_calibrate_mute(chip, 0);
606-
up(&chip->mce_mutex);
606+
mutex_unlock(&chip->mce_mutex);
607607
}
608608

609609
/*
@@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
709709
{
710710
unsigned long flags;
711711

712-
down(&chip->open_mutex);
712+
mutex_lock(&chip->open_mutex);
713713
if ((chip->mode & mode) ||
714714
((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) {
715-
up(&chip->open_mutex);
715+
mutex_unlock(&chip->open_mutex);
716716
return -EAGAIN;
717717
}
718718
if (chip->mode & CS4231_MODE_OPEN) {
719719
chip->mode |= mode;
720-
up(&chip->open_mutex);
720+
mutex_unlock(&chip->open_mutex);
721721
return 0;
722722
}
723723
/* ok. now enable and ack CODEC IRQ */
@@ -737,18 +737,18 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode)
737737
spin_unlock_irqrestore(&chip->reg_lock, flags);
738738

739739
chip->mode = mode;
740-
up(&chip->open_mutex);
740+
mutex_unlock(&chip->open_mutex);
741741
return 0;
742742
}
743743

744744
static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
745745
{
746746
unsigned long flags;
747747

748-
down(&chip->open_mutex);
748+
mutex_lock(&chip->open_mutex);
749749
chip->mode &= ~mode;
750750
if (chip->mode & CS4231_MODE_OPEN) {
751-
up(&chip->open_mutex);
751+
mutex_unlock(&chip->open_mutex);
752752
return;
753753
}
754754
snd_cs4231_calibrate_mute(chip, 1);
@@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode)
785785
snd_cs4231_calibrate_mute(chip, 0);
786786

787787
chip->mode = 0;
788-
up(&chip->open_mutex);
788+
mutex_unlock(&chip->open_mutex);
789789
}
790790

791791
/*
@@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card,
14081408
chip->hwshare = hwshare;
14091409

14101410
spin_lock_init(&chip->reg_lock);
1411-
init_MUTEX(&chip->mce_mutex);
1412-
init_MUTEX(&chip->open_mutex);
1411+
mutex_init(&chip->mce_mutex);
1412+
mutex_init(&chip->open_mutex);
14131413
chip->card = card;
14141414
chip->rate_constraint = snd_cs4231_xrate;
14151415
chip->set_playback_format = snd_cs4231_playback_format;
@@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm)
15381538
return err;
15391539

15401540
spin_lock_init(&chip->reg_lock);
1541-
init_MUTEX(&chip->mce_mutex);
1542-
init_MUTEX(&chip->open_mutex);
1541+
mutex_init(&chip->mce_mutex);
1542+
mutex_init(&chip->open_mutex);
15431543

15441544
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops);
15451545
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops);

‎sound/isa/cs423x/cs4236_lib.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
841841

842842
enable = ucontrol->value.integer.value[0] & 1;
843843

844-
down(&chip->mce_mutex);
844+
mutex_lock(&chip->mce_mutex);
845845
snd_cs4231_mce_up(chip);
846846
spin_lock_irqsave(&chip->reg_lock, flags);
847847
val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
@@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
854854
snd_cs4236_ctrl_out(chip, 4, val);
855855
spin_unlock_irqrestore(&chip->reg_lock, flags);
856856
snd_cs4231_mce_down(chip);
857-
up(&chip->mce_mutex);
857+
mutex_unlock(&chip->mce_mutex);
858858

859859
#if 0
860860
printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",

‎sound/isa/gus/gus_dma.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,26 +149,26 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus)
149149

150150
int snd_gf1_dma_init(struct snd_gus_card * gus)
151151
{
152-
down(&gus->dma_mutex);
152+
mutex_lock(&gus->dma_mutex);
153153
gus->gf1.dma_shared++;
154154
if (gus->gf1.dma_shared > 1) {
155-
up(&gus->dma_mutex);
155+
mutex_unlock(&gus->dma_mutex);
156156
return 0;
157157
}
158158
gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt;
159159
gus->gf1.dma_data_pcm =
160160
gus->gf1.dma_data_pcm_last =
161161
gus->gf1.dma_data_synth =
162162
gus->gf1.dma_data_synth_last = NULL;
163-
up(&gus->dma_mutex);
163+
mutex_unlock(&gus->dma_mutex);
164164
return 0;
165165
}
166166

167167
int snd_gf1_dma_done(struct snd_gus_card * gus)
168168
{
169169
struct snd_gf1_dma_block *block;
170170

171-
down(&gus->dma_mutex);
171+
mutex_lock(&gus->dma_mutex);
172172
gus->gf1.dma_shared--;
173173
if (!gus->gf1.dma_shared) {
174174
snd_dma_disable(gus->gf1.dma1);
@@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus)
185185
gus->gf1.dma_data_pcm_last =
186186
gus->gf1.dma_data_synth_last = NULL;
187187
}
188-
up(&gus->dma_mutex);
188+
mutex_unlock(&gus->dma_mutex);
189189
return 0;
190190
}
191191

‎sound/isa/gus/gus_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card,
225225
spin_lock_init(&gus->dma_lock);
226226
spin_lock_init(&gus->pcm_volume_level_lock);
227227
spin_lock_init(&gus->uart_cmd_lock);
228-
init_MUTEX(&gus->dma_mutex);
228+
mutex_init(&gus->dma_mutex);
229229
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) {
230230
snd_gus_free(gus);
231231
return err;

‎sound/isa/gus/gus_mem.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
3434
void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup)
3535
{
3636
if (!xup) {
37-
down(&alloc->memory_mutex);
37+
mutex_lock(&alloc->memory_mutex);
3838
} else {
39-
up(&alloc->memory_mutex);
39+
mutex_unlock(&alloc->memory_mutex);
4040
}
4141
}
4242

@@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
5959
alloc->first = nblock;
6060
else
6161
nblock->prev->next = nblock;
62-
up(&alloc->memory_mutex);
62+
mutex_unlock(&alloc->memory_mutex);
6363
return NULL;
6464
}
6565
pblock = pblock->next;
@@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo
8080
{
8181
if (block->share) { /* ok.. shared block */
8282
block->share--;
83-
up(&alloc->memory_mutex);
83+
mutex_unlock(&alloc->memory_mutex);
8484
return 0;
8585
}
8686
if (alloc->first == block) {
@@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus)
244244
#endif
245245

246246
alloc = &gus->gf1.mem_alloc;
247-
init_MUTEX(&alloc->memory_mutex);
247+
mutex_init(&alloc->memory_mutex);
248248
alloc->first = alloc->last = NULL;
249249
if (!gus->gf1.memory)
250250
return 0;
@@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
299299

300300
gus = entry->private_data;
301301
alloc = &gus->gf1.mem_alloc;
302-
down(&alloc->memory_mutex);
302+
mutex_lock(&alloc->memory_mutex);
303303
snd_iprintf(buffer, "8-bit banks : \n ");
304304
for (i = 0; i < 4; i++)
305305
snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : "");
@@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry,
343343
}
344344
snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n",
345345
total, used, total - used);
346-
up(&alloc->memory_mutex);
346+
mutex_unlock(&alloc->memory_mutex);
347347
#if 0
348348
ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n",
349349
ultra_memory_free_size(card, &card->gf1.mem_alloc),

0 commit comments

Comments
 (0)