Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Ingo Molnar and committed by
Jaroslav Kysela
8b7547f9 ef9f0a42

+57 -57
+1 -1
include/sound/ad1848.h
··· 154 154 #endif 155 155 156 156 spinlock_t reg_lock; 157 - struct semaphore open_mutex; 157 + struct mutex open_mutex; 158 158 }; 159 159 160 160 /* exported functions */
+2 -2
include/sound/cs4231.h
··· 248 248 unsigned int c_dma_size; 249 249 250 250 spinlock_t reg_lock; 251 - struct semaphore mce_mutex; 252 - struct semaphore open_mutex; 251 + struct mutex mce_mutex; 252 + struct mutex open_mutex; 253 253 254 254 int (*rate_constraint) (struct snd_pcm_runtime *runtime); 255 255 void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr);
+3 -3
include/sound/gus.h
··· 209 209 struct snd_gf1_bank_info banks_16[4]; 210 210 struct snd_gf1_mem_block *first; 211 211 struct snd_gf1_mem_block *last; 212 - struct semaphore memory_mutex; 212 + struct mutex memory_mutex; 213 213 }; 214 214 215 215 struct snd_gf1_dma_block { ··· 467 467 spinlock_t dma_lock; 468 468 spinlock_t pcm_volume_level_lock; 469 469 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; 472 472 }; 473 473 474 474 /* I/O functions for GF1/InterWave chip - gus_io.c */
+1 -1
include/sound/sb16_csp.h
··· 158 158 struct snd_kcontrol *qsound_switch; 159 159 struct snd_kcontrol *qsound_space; 160 160 161 - struct semaphore access_mutex; /* locking */ 161 + struct mutex access_mutex; /* locking */ 162 162 }; 163 163 164 164 int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep);
+7 -7
sound/isa/ad1848/ad1848_lib.c
··· 387 387 { 388 388 unsigned long flags; 389 389 390 - down(&chip->open_mutex); 390 + mutex_lock(&chip->open_mutex); 391 391 if (chip->mode & AD1848_MODE_OPEN) { 392 - up(&chip->open_mutex); 392 + mutex_unlock(&chip->open_mutex); 393 393 return -EAGAIN; 394 394 } 395 395 snd_ad1848_mce_down(chip); ··· 432 432 spin_unlock_irqrestore(&chip->reg_lock, flags); 433 433 434 434 chip->mode = mode; 435 - up(&chip->open_mutex); 435 + mutex_unlock(&chip->open_mutex); 436 436 437 437 return 0; 438 438 } ··· 441 441 { 442 442 unsigned long flags; 443 443 444 - down(&chip->open_mutex); 444 + mutex_lock(&chip->open_mutex); 445 445 if (!chip->mode) { 446 - up(&chip->open_mutex); 446 + mutex_unlock(&chip->open_mutex); 447 447 return; 448 448 } 449 449 /* disable IRQ */ ··· 471 471 spin_unlock_irqrestore(&chip->reg_lock, flags); 472 472 473 473 chip->mode = 0; 474 - up(&chip->open_mutex); 474 + mutex_unlock(&chip->open_mutex); 475 475 } 476 476 477 477 /* ··· 889 889 if (chip == NULL) 890 890 return -ENOMEM; 891 891 spin_lock_init(&chip->reg_lock); 892 - init_MUTEX(&chip->open_mutex); 892 + mutex_init(&chip->open_mutex); 893 893 chip->card = card; 894 894 chip->port = port; 895 895 chip->irq = -1;
+15 -15
sound/isa/cs423x/cs4231_lib.c
··· 531 531 unsigned long flags; 532 532 int full_calib = 1; 533 533 534 - down(&chip->mce_mutex); 534 + mutex_lock(&chip->mce_mutex); 535 535 snd_cs4231_calibrate_mute(chip, 1); 536 536 if (chip->hardware == CS4231_HW_CS4231A || 537 537 (chip->hardware & CS4231_HW_CS4232_MASK)) { ··· 560 560 snd_cs4231_mce_down(chip); 561 561 } 562 562 snd_cs4231_calibrate_mute(chip, 0); 563 - up(&chip->mce_mutex); 563 + mutex_unlock(&chip->mce_mutex); 564 564 } 565 565 566 566 static void snd_cs4231_capture_format(struct snd_cs4231 *chip, ··· 570 570 unsigned long flags; 571 571 int full_calib = 1; 572 572 573 - down(&chip->mce_mutex); 573 + mutex_lock(&chip->mce_mutex); 574 574 snd_cs4231_calibrate_mute(chip, 1); 575 575 if (chip->hardware == CS4231_HW_CS4231A || 576 576 (chip->hardware & CS4231_HW_CS4232_MASK)) { ··· 603 603 snd_cs4231_mce_down(chip); 604 604 } 605 605 snd_cs4231_calibrate_mute(chip, 0); 606 - up(&chip->mce_mutex); 606 + mutex_unlock(&chip->mce_mutex); 607 607 } 608 608 609 609 /* ··· 709 709 { 710 710 unsigned long flags; 711 711 712 - down(&chip->open_mutex); 712 + mutex_lock(&chip->open_mutex); 713 713 if ((chip->mode & mode) || 714 714 ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { 715 - up(&chip->open_mutex); 715 + mutex_unlock(&chip->open_mutex); 716 716 return -EAGAIN; 717 717 } 718 718 if (chip->mode & CS4231_MODE_OPEN) { 719 719 chip->mode |= mode; 720 - up(&chip->open_mutex); 720 + mutex_unlock(&chip->open_mutex); 721 721 return 0; 722 722 } 723 723 /* ok. now enable and ack CODEC IRQ */ ··· 737 737 spin_unlock_irqrestore(&chip->reg_lock, flags); 738 738 739 739 chip->mode = mode; 740 - up(&chip->open_mutex); 740 + mutex_unlock(&chip->open_mutex); 741 741 return 0; 742 742 } 743 743 ··· 745 745 { 746 746 unsigned long flags; 747 747 748 - down(&chip->open_mutex); 748 + mutex_lock(&chip->open_mutex); 749 749 chip->mode &= ~mode; 750 750 if (chip->mode & CS4231_MODE_OPEN) { 751 - up(&chip->open_mutex); 751 + mutex_unlock(&chip->open_mutex); 752 752 return; 753 753 } 754 754 snd_cs4231_calibrate_mute(chip, 1); ··· 785 785 snd_cs4231_calibrate_mute(chip, 0); 786 786 787 787 chip->mode = 0; 788 - up(&chip->open_mutex); 788 + mutex_unlock(&chip->open_mutex); 789 789 } 790 790 791 791 /* ··· 1408 1408 chip->hwshare = hwshare; 1409 1409 1410 1410 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); 1413 1413 chip->card = card; 1414 1414 chip->rate_constraint = snd_cs4231_xrate; 1415 1415 chip->set_playback_format = snd_cs4231_playback_format; ··· 1538 1538 return err; 1539 1539 1540 1540 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); 1543 1543 1544 1544 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); 1545 1545 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops);
+2 -2
sound/isa/cs423x/cs4236_lib.c
··· 841 841 842 842 enable = ucontrol->value.integer.value[0] & 1; 843 843 844 - down(&chip->mce_mutex); 844 + mutex_lock(&chip->mce_mutex); 845 845 snd_cs4231_mce_up(chip); 846 846 spin_lock_irqsave(&chip->reg_lock, flags); 847 847 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); ··· 854 854 snd_cs4236_ctrl_out(chip, 4, val); 855 855 spin_unlock_irqrestore(&chip->reg_lock, flags); 856 856 snd_cs4231_mce_down(chip); 857 - up(&chip->mce_mutex); 857 + mutex_unlock(&chip->mce_mutex); 858 858 859 859 #if 0 860 860 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
+5 -5
sound/isa/gus/gus_dma.c
··· 149 149 150 150 int snd_gf1_dma_init(struct snd_gus_card * gus) 151 151 { 152 - down(&gus->dma_mutex); 152 + mutex_lock(&gus->dma_mutex); 153 153 gus->gf1.dma_shared++; 154 154 if (gus->gf1.dma_shared > 1) { 155 - up(&gus->dma_mutex); 155 + mutex_unlock(&gus->dma_mutex); 156 156 return 0; 157 157 } 158 158 gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt; ··· 160 160 gus->gf1.dma_data_pcm_last = 161 161 gus->gf1.dma_data_synth = 162 162 gus->gf1.dma_data_synth_last = NULL; 163 - up(&gus->dma_mutex); 163 + mutex_unlock(&gus->dma_mutex); 164 164 return 0; 165 165 } 166 166 ··· 168 168 { 169 169 struct snd_gf1_dma_block *block; 170 170 171 - down(&gus->dma_mutex); 171 + mutex_lock(&gus->dma_mutex); 172 172 gus->gf1.dma_shared--; 173 173 if (!gus->gf1.dma_shared) { 174 174 snd_dma_disable(gus->gf1.dma1); ··· 185 185 gus->gf1.dma_data_pcm_last = 186 186 gus->gf1.dma_data_synth_last = NULL; 187 187 } 188 - up(&gus->dma_mutex); 188 + mutex_unlock(&gus->dma_mutex); 189 189 return 0; 190 190 } 191 191
+1 -1
sound/isa/gus/gus_main.c
··· 225 225 spin_lock_init(&gus->dma_lock); 226 226 spin_lock_init(&gus->pcm_volume_level_lock); 227 227 spin_lock_init(&gus->uart_cmd_lock); 228 - init_MUTEX(&gus->dma_mutex); 228 + mutex_init(&gus->dma_mutex); 229 229 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) { 230 230 snd_gus_free(gus); 231 231 return err;
+7 -7
sound/isa/gus/gus_mem.c
··· 34 34 void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) 35 35 { 36 36 if (!xup) { 37 - down(&alloc->memory_mutex); 37 + mutex_lock(&alloc->memory_mutex); 38 38 } else { 39 - up(&alloc->memory_mutex); 39 + mutex_unlock(&alloc->memory_mutex); 40 40 } 41 41 } 42 42 ··· 59 59 alloc->first = nblock; 60 60 else 61 61 nblock->prev->next = nblock; 62 - up(&alloc->memory_mutex); 62 + mutex_unlock(&alloc->memory_mutex); 63 63 return NULL; 64 64 } 65 65 pblock = pblock->next; ··· 80 80 { 81 81 if (block->share) { /* ok.. shared block */ 82 82 block->share--; 83 - up(&alloc->memory_mutex); 83 + mutex_unlock(&alloc->memory_mutex); 84 84 return 0; 85 85 } 86 86 if (alloc->first == block) { ··· 244 244 #endif 245 245 246 246 alloc = &gus->gf1.mem_alloc; 247 - init_MUTEX(&alloc->memory_mutex); 247 + mutex_init(&alloc->memory_mutex); 248 248 alloc->first = alloc->last = NULL; 249 249 if (!gus->gf1.memory) 250 250 return 0; ··· 299 299 300 300 gus = entry->private_data; 301 301 alloc = &gus->gf1.mem_alloc; 302 - down(&alloc->memory_mutex); 302 + mutex_lock(&alloc->memory_mutex); 303 303 snd_iprintf(buffer, "8-bit banks : \n "); 304 304 for (i = 0; i < 4; i++) 305 305 snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); ··· 343 343 } 344 344 snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", 345 345 total, used, total - used); 346 - up(&alloc->memory_mutex); 346 + mutex_unlock(&alloc->memory_mutex); 347 347 #if 0 348 348 ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", 349 349 ultra_memory_free_size(card, &card->gf1.mem_alloc),
+7 -7
sound/isa/gus/gus_synth.c
··· 55 55 56 56 if (info->voices > 32) 57 57 return -EINVAL; 58 - down(&gus->register_mutex); 58 + mutex_lock(&gus->register_mutex); 59 59 if (!snd_gus_use_inc(gus)) { 60 - up(&gus->register_mutex); 60 + mutex_unlock(&gus->register_mutex); 61 61 return -EFAULT; 62 62 } 63 63 for (idx = 0; idx < info->voices; idx++) { ··· 65 65 if (voice == NULL) { 66 66 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); 67 67 snd_gus_use_dec(gus); 68 - up(&gus->register_mutex); 68 + mutex_unlock(&gus->register_mutex); 69 69 return -EBUSY; 70 70 } 71 71 voice->index = idx; 72 72 } 73 - up(&gus->register_mutex); 73 + mutex_unlock(&gus->register_mutex); 74 74 return 0; 75 75 } 76 76 ··· 79 79 struct snd_gus_port * port = private_data; 80 80 struct snd_gus_card * gus = port->gus; 81 81 82 - down(&gus->register_mutex); 82 + mutex_lock(&gus->register_mutex); 83 83 snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); 84 84 snd_gus_use_dec(gus); 85 - up(&gus->register_mutex); 85 + mutex_unlock(&gus->register_mutex); 86 86 return 0; 87 87 } 88 88 ··· 223 223 if (gus == NULL) 224 224 return -EINVAL; 225 225 226 - init_MUTEX(&gus->register_mutex); 226 + mutex_init(&gus->register_mutex); 227 227 gus->gf1.seq_client = -1; 228 228 229 229 /* allocate new client */
+6 -6
sound/isa/sb/sb16_csp.c
··· 138 138 p->ops.csp_stop = snd_sb_csp_stop; 139 139 p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; 140 140 141 - init_MUTEX(&p->access_mutex); 141 + mutex_init(&p->access_mutex); 142 142 sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f)); 143 143 hw->iface = SNDRV_HWDEP_IFACE_SB16CSP; 144 144 hw->private_data = p; ··· 265 265 */ 266 266 static int snd_sb_csp_use(struct snd_sb_csp * p) 267 267 { 268 - down(&p->access_mutex); 268 + mutex_lock(&p->access_mutex); 269 269 if (p->used) { 270 - up(&p->access_mutex); 270 + mutex_unlock(&p->access_mutex); 271 271 return -EAGAIN; 272 272 } 273 273 p->used++; 274 - up(&p->access_mutex); 274 + mutex_unlock(&p->access_mutex); 275 275 276 276 return 0; 277 277 ··· 282 282 */ 283 283 static int snd_sb_csp_unuse(struct snd_sb_csp * p) 284 284 { 285 - down(&p->access_mutex); 285 + mutex_lock(&p->access_mutex); 286 286 p->used--; 287 - up(&p->access_mutex); 287 + mutex_unlock(&p->access_mutex); 288 288 289 289 return 0; 290 290 }