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

[ALSA] semaphore -> mutex (PCI 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
62932df8 8b7547f9

+549 -489
+2 -2
include/sound/ac97_codec.h
··· 456 456 struct snd_info_entry *proc_regs; 457 457 unsigned short subsystem_vendor; 458 458 unsigned short subsystem_device; 459 - struct semaphore reg_mutex; 460 - struct semaphore page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ 459 + struct mutex reg_mutex; 460 + struct mutex page_mutex; /* mutex for AD18xx multi-codecs and paging (2.3) */ 461 461 unsigned short num; /* number of codec: 0 = primary, 1 = secondary */ 462 462 unsigned short addr; /* physical address of codec [0-3] */ 463 463 unsigned int id; /* identification of codec */
+1 -1
include/sound/ak4531_codec.h
··· 71 71 void (*private_free) (struct snd_ak4531 *ak4531); 72 72 /* --- */ 73 73 unsigned char regs[0x20]; 74 - struct semaphore reg_mutex; 74 + struct mutex reg_mutex; 75 75 }; 76 76 77 77 int snd_ak4531_mixer(struct snd_card *card, struct snd_ak4531 *_ak4531,
+1 -1
include/sound/cs46xx.h
··· 1711 1711 int current_gpio; 1712 1712 #endif 1713 1713 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1714 - struct semaphore spos_mutex; 1714 + struct mutex spos_mutex; 1715 1715 1716 1716 struct dsp_spos_instance * dsp_spos_instance; 1717 1717
+2 -2
include/sound/emu10k1.h
··· 33 33 #include <sound/pcm-indirect.h> 34 34 #include <sound/timer.h> 35 35 #include <linux/interrupt.h> 36 + #include <linux/mutex.h> 36 37 #include <asm/io.h> 37 38 38 39 /* ------------------- DEFINES -------------------- */ ··· 1023 1022 int gpr_size; /* size of allocated GPR controls */ 1024 1023 int gpr_count; /* count of used kcontrols */ 1025 1024 struct list_head gpr_ctl; /* GPR controls */ 1026 - struct semaphore lock; 1025 + struct mutex lock; 1027 1026 struct snd_emu10k1_fx8010_pcm pcm[8]; 1028 1027 spinlock_t irq_lock; 1029 1028 struct snd_emu10k1_fx8010_irq *irq_handlers; ··· 1123 1122 spinlock_t reg_lock; 1124 1123 spinlock_t emu_lock; 1125 1124 spinlock_t voice_lock; 1126 - struct semaphore ptb_lock; 1127 1125 1128 1126 struct snd_emu10k1_voice voices[NUM_G]; 1129 1127 struct snd_emu10k1_voice p16v_voices[4];
+23 -22
sound/pci/ac97/ac97_codec.c
··· 28 28 #include <linux/slab.h> 29 29 #include <linux/pci.h> 30 30 #include <linux/moduleparam.h> 31 + #include <linux/mutex.h> 31 32 #include <sound/core.h> 32 33 #include <sound/pcm.h> 33 34 #include <sound/ac97_codec.h> ··· 297 296 { 298 297 if (!snd_ac97_valid_reg(ac97, reg)) 299 298 return; 300 - down(&ac97->reg_mutex); 299 + mutex_lock(&ac97->reg_mutex); 301 300 ac97->regs[reg] = value; 302 301 ac97->bus->ops->write(ac97, reg, value); 303 302 set_bit(reg, ac97->reg_accessed); 304 - up(&ac97->reg_mutex); 303 + mutex_unlock(&ac97->reg_mutex); 305 304 } 306 305 307 306 /** ··· 322 321 323 322 if (!snd_ac97_valid_reg(ac97, reg)) 324 323 return -EINVAL; 325 - down(&ac97->reg_mutex); 324 + mutex_lock(&ac97->reg_mutex); 326 325 change = ac97->regs[reg] != value; 327 326 if (change) { 328 327 ac97->regs[reg] = value; 329 328 ac97->bus->ops->write(ac97, reg, value); 330 329 } 331 330 set_bit(reg, ac97->reg_accessed); 332 - up(&ac97->reg_mutex); 331 + mutex_unlock(&ac97->reg_mutex); 333 332 return change; 334 333 } 335 334 ··· 352 351 353 352 if (!snd_ac97_valid_reg(ac97, reg)) 354 353 return -EINVAL; 355 - down(&ac97->reg_mutex); 354 + mutex_lock(&ac97->reg_mutex); 356 355 change = snd_ac97_update_bits_nolock(ac97, reg, mask, value); 357 - up(&ac97->reg_mutex); 356 + mutex_unlock(&ac97->reg_mutex); 358 357 return change; 359 358 } 360 359 ··· 381 380 int change; 382 381 unsigned short old, new, cfg; 383 382 384 - down(&ac97->page_mutex); 383 + mutex_lock(&ac97->page_mutex); 385 384 old = ac97->spec.ad18xx.pcmreg[codec]; 386 385 new = (old & ~mask) | value; 387 386 change = old != new; 388 387 if (change) { 389 - down(&ac97->reg_mutex); 388 + mutex_lock(&ac97->reg_mutex); 390 389 cfg = snd_ac97_read_cache(ac97, AC97_AD_SERIAL_CFG); 391 390 ac97->spec.ad18xx.pcmreg[codec] = new; 392 391 /* select single codec */ ··· 398 397 /* select all codecs */ 399 398 ac97->bus->ops->write(ac97, AC97_AD_SERIAL_CFG, 400 399 cfg | 0x7000); 401 - up(&ac97->reg_mutex); 400 + mutex_unlock(&ac97->reg_mutex); 402 401 } 403 - up(&ac97->page_mutex); 402 + mutex_unlock(&ac97->page_mutex); 404 403 return change; 405 404 } 406 405 ··· 468 467 (ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23 && 469 468 (reg >= 0x60 && reg < 0x70)) { 470 469 unsigned short page = (kcontrol->private_value >> 26) & 0x0f; 471 - down(&ac97->page_mutex); /* lock paging */ 470 + mutex_lock(&ac97->page_mutex); /* lock paging */ 472 471 page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK; 473 472 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page); 474 473 } ··· 479 478 { 480 479 if (page_save >= 0) { 481 480 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save); 482 - up(&ac97->page_mutex); /* unlock paging */ 481 + mutex_unlock(&ac97->page_mutex); /* unlock paging */ 483 482 } 484 483 } 485 484 ··· 675 674 { 676 675 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 677 676 678 - down(&ac97->reg_mutex); 677 + mutex_lock(&ac97->reg_mutex); 679 678 ucontrol->value.iec958.status[0] = ac97->spdif_status & 0xff; 680 679 ucontrol->value.iec958.status[1] = (ac97->spdif_status >> 8) & 0xff; 681 680 ucontrol->value.iec958.status[2] = (ac97->spdif_status >> 16) & 0xff; 682 681 ucontrol->value.iec958.status[3] = (ac97->spdif_status >> 24) & 0xff; 683 - up(&ac97->reg_mutex); 682 + mutex_unlock(&ac97->reg_mutex); 684 683 return 0; 685 684 } 686 685 ··· 719 718 } 720 719 } 721 720 722 - down(&ac97->reg_mutex); 721 + mutex_lock(&ac97->reg_mutex); 723 722 change = ac97->spdif_status != new; 724 723 ac97->spdif_status = new; 725 724 ··· 747 746 snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */ 748 747 } 749 748 } 750 - up(&ac97->reg_mutex); 749 + mutex_unlock(&ac97->reg_mutex); 751 750 752 751 return change; 753 752 } ··· 764 763 765 764 value = (ucontrol->value.integer.value[0] & mask); 766 765 767 - down(&ac97->reg_mutex); 766 + mutex_lock(&ac97->reg_mutex); 768 767 mask <<= shift; 769 768 value <<= shift; 770 769 old = snd_ac97_read_cache(ac97, reg); ··· 778 777 if (extst & AC97_EA_SPDIF) 779 778 snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); /* turn on again */ 780 779 } 781 - up(&ac97->reg_mutex); 780 + mutex_unlock(&ac97->reg_mutex); 782 781 return change; 783 782 } 784 783 ··· 889 888 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 890 889 int codec = kcontrol->private_value & 3; 891 890 892 - down(&ac97->page_mutex); 891 + mutex_lock(&ac97->page_mutex); 893 892 ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31); 894 893 ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31); 895 - up(&ac97->page_mutex); 894 + mutex_unlock(&ac97->page_mutex); 896 895 return 0; 897 896 } 898 897 ··· 1857 1856 ac97->limited_regs = template->limited_regs; 1858 1857 memcpy(ac97->reg_accessed, template->reg_accessed, sizeof(ac97->reg_accessed)); 1859 1858 bus->codec[ac97->num] = ac97; 1860 - init_MUTEX(&ac97->reg_mutex); 1861 - init_MUTEX(&ac97->page_mutex); 1859 + mutex_init(&ac97->reg_mutex); 1860 + mutex_init(&ac97->page_mutex); 1862 1861 1863 1862 #ifdef CONFIG_PCI 1864 1863 if (ac97->pci) {
+6 -4
sound/pci/ac97/ac97_patch.c
··· 27 27 #include <linux/delay.h> 28 28 #include <linux/init.h> 29 29 #include <linux/slab.h> 30 + #include <linux/mutex.h> 31 + 30 32 #include <sound/core.h> 31 33 #include <sound/pcm.h> 32 34 #include <sound/control.h> ··· 57 55 unsigned short page_save; 58 56 int ret; 59 57 60 - down(&ac97->page_mutex); 58 + mutex_lock(&ac97->page_mutex); 61 59 page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK; 62 60 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page); 63 61 ret = snd_ac97_update_bits(ac97, reg, mask, value); 64 62 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save); 65 - up(&ac97->page_mutex); /* unlock paging */ 63 + mutex_unlock(&ac97->page_mutex); /* unlock paging */ 66 64 return ret; 67 65 } 68 66 ··· 899 897 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 900 898 int err; 901 899 902 - down(&ac97->page_mutex); 900 + mutex_lock(&ac97->page_mutex); 903 901 snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0xabba); 904 902 err = snd_ac97_update_bits(ac97, AC97_SIGMATEL_BIAS2, 0x0010, 905 903 (ucontrol->value.integer.value[0] & 1) << 4); 906 904 snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0); 907 - up(&ac97->page_mutex); 905 + mutex_unlock(&ac97->page_mutex); 908 906 return err; 909 907 } 910 908
+4 -2
sound/pci/ac97/ac97_pcm.c
··· 27 27 #include <linux/delay.h> 28 28 #include <linux/init.h> 29 29 #include <linux/slab.h> 30 + #include <linux/mutex.h> 31 + 30 32 #include <sound/core.h> 31 33 #include <sound/pcm.h> 32 34 #include <sound/control.h> ··· 208 206 mask = AC97_SC_SPSR_MASK; 209 207 } 210 208 211 - down(&ac97->reg_mutex); 209 + mutex_lock(&ac97->reg_mutex); 212 210 old = snd_ac97_read(ac97, reg) & mask; 213 211 if (old != bits) { 214 212 snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); ··· 233 231 ac97->spdif_status = sbits; 234 232 } 235 233 snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, AC97_EA_SPDIF); 236 - up(&ac97->reg_mutex); 234 + mutex_unlock(&ac97->reg_mutex); 237 235 return 0; 238 236 } 239 237
+8 -6
sound/pci/ac97/ac97_proc.c
··· 24 24 25 25 #include <sound/driver.h> 26 26 #include <linux/slab.h> 27 + #include <linux/mutex.h> 28 + 27 29 #include <sound/core.h> 28 30 #include <sound/ac97_codec.h> 29 31 #include <sound/asoundef.h> ··· 340 338 { 341 339 struct snd_ac97 *ac97 = entry->private_data; 342 340 343 - down(&ac97->page_mutex); 341 + mutex_lock(&ac97->page_mutex); 344 342 if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86 345 343 int idx; 346 344 for (idx = 0; idx < 3; idx++) ··· 366 364 } else { 367 365 snd_ac97_proc_read_main(ac97, buffer, 0); 368 366 } 369 - up(&ac97->page_mutex); 367 + mutex_unlock(&ac97->page_mutex); 370 368 } 371 369 372 370 #ifdef CONFIG_SND_DEBUG ··· 376 374 struct snd_ac97 *ac97 = entry->private_data; 377 375 char line[64]; 378 376 unsigned int reg, val; 379 - down(&ac97->page_mutex); 377 + mutex_lock(&ac97->page_mutex); 380 378 while (!snd_info_get_line(buffer, line, sizeof(line))) { 381 379 if (sscanf(line, "%x %x", &reg, &val) != 2) 382 380 continue; ··· 384 382 if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff) 385 383 snd_ac97_write_cache(ac97, reg, val); 386 384 } 387 - up(&ac97->page_mutex); 385 + mutex_unlock(&ac97->page_mutex); 388 386 } 389 387 #endif 390 388 ··· 403 401 { 404 402 struct snd_ac97 *ac97 = entry->private_data; 405 403 406 - down(&ac97->page_mutex); 404 + mutex_lock(&ac97->page_mutex); 407 405 if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) { // Analog Devices AD1881/85/86 408 406 409 407 int idx; ··· 419 417 } else { 420 418 snd_ac97_proc_regs_read_main(ac97, buffer, 0); 421 419 } 422 - up(&ac97->page_mutex); 420 + mutex_unlock(&ac97->page_mutex); 423 421 } 424 422 425 423 void snd_ac97_proc_init(struct snd_ac97 * ac97)
+15 -13
sound/pci/ac97/ak4531_codec.c
··· 23 23 #include <linux/delay.h> 24 24 #include <linux/init.h> 25 25 #include <linux/slab.h> 26 + #include <linux/mutex.h> 27 + 26 28 #include <sound/core.h> 27 29 #include <sound/ak4531_codec.h> 28 30 ··· 84 82 int invert = (kcontrol->private_value >> 22) & 1; 85 83 int val; 86 84 87 - down(&ak4531->reg_mutex); 85 + mutex_lock(&ak4531->reg_mutex); 88 86 val = (ak4531->regs[reg] >> shift) & mask; 89 - up(&ak4531->reg_mutex); 87 + mutex_unlock(&ak4531->reg_mutex); 90 88 if (invert) { 91 89 val = mask - val; 92 90 } ··· 109 107 val = mask - val; 110 108 } 111 109 val <<= shift; 112 - down(&ak4531->reg_mutex); 110 + mutex_lock(&ak4531->reg_mutex); 113 111 val = (ak4531->regs[reg] & ~(mask << shift)) | val; 114 112 change = val != ak4531->regs[reg]; 115 113 ak4531->write(ak4531, reg, ak4531->regs[reg] = val); 116 - up(&ak4531->reg_mutex); 114 + mutex_unlock(&ak4531->reg_mutex); 117 115 return change; 118 116 } 119 117 ··· 145 143 int invert = (kcontrol->private_value >> 22) & 1; 146 144 int left, right; 147 145 148 - down(&ak4531->reg_mutex); 146 + mutex_lock(&ak4531->reg_mutex); 149 147 left = (ak4531->regs[left_reg] >> left_shift) & mask; 150 148 right = (ak4531->regs[right_reg] >> right_shift) & mask; 151 - up(&ak4531->reg_mutex); 149 + mutex_unlock(&ak4531->reg_mutex); 152 150 if (invert) { 153 151 left = mask - left; 154 152 right = mask - right; ··· 178 176 } 179 177 left <<= left_shift; 180 178 right <<= right_shift; 181 - down(&ak4531->reg_mutex); 179 + mutex_lock(&ak4531->reg_mutex); 182 180 if (left_reg == right_reg) { 183 181 left = (ak4531->regs[left_reg] & ~((mask << left_shift) | (mask << right_shift))) | left | right; 184 182 change = left != ak4531->regs[left_reg]; ··· 190 188 ak4531->write(ak4531, left_reg, ak4531->regs[left_reg] = left); 191 189 ak4531->write(ak4531, right_reg, ak4531->regs[right_reg] = right); 192 190 } 193 - up(&ak4531->reg_mutex); 191 + mutex_unlock(&ak4531->reg_mutex); 194 192 return change; 195 193 } 196 194 ··· 217 215 int left_shift = (kcontrol->private_value >> 16) & 0x0f; 218 216 int right_shift = (kcontrol->private_value >> 24) & 0x0f; 219 217 220 - down(&ak4531->reg_mutex); 218 + mutex_lock(&ak4531->reg_mutex); 221 219 ucontrol->value.integer.value[0] = (ak4531->regs[reg1] >> left_shift) & 1; 222 220 ucontrol->value.integer.value[1] = (ak4531->regs[reg2] >> left_shift) & 1; 223 221 ucontrol->value.integer.value[2] = (ak4531->regs[reg1] >> right_shift) & 1; 224 222 ucontrol->value.integer.value[3] = (ak4531->regs[reg2] >> right_shift) & 1; 225 - up(&ak4531->reg_mutex); 223 + mutex_unlock(&ak4531->reg_mutex); 226 224 return 0; 227 225 } 228 226 ··· 236 234 int change; 237 235 int val1, val2; 238 236 239 - down(&ak4531->reg_mutex); 237 + mutex_lock(&ak4531->reg_mutex); 240 238 val1 = ak4531->regs[reg1] & ~((1 << left_shift) | (1 << right_shift)); 241 239 val2 = ak4531->regs[reg2] & ~((1 << left_shift) | (1 << right_shift)); 242 240 val1 |= (ucontrol->value.integer.value[0] & 1) << left_shift; ··· 246 244 change = val1 != ak4531->regs[reg1] || val2 != ak4531->regs[reg2]; 247 245 ak4531->write(ak4531, reg1, ak4531->regs[reg1] = val1); 248 246 ak4531->write(ak4531, reg2, ak4531->regs[reg2] = val2); 249 - up(&ak4531->reg_mutex); 247 + mutex_unlock(&ak4531->reg_mutex); 250 248 return change; 251 249 } 252 250 ··· 368 366 if (ak4531 == NULL) 369 367 return -ENOMEM; 370 368 *ak4531 = *_ak4531; 371 - init_MUTEX(&ak4531->reg_mutex); 369 + mutex_init(&ak4531->reg_mutex); 372 370 if ((err = snd_component_add(card, "AK4531")) < 0) { 373 371 snd_ak4531_free(ak4531); 374 372 return err;
+11 -10
sound/pci/atiixp.c
··· 27 27 #include <linux/pci.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/moduleparam.h> 30 + #include <linux/mutex.h> 30 31 #include <sound/core.h> 31 32 #include <sound/pcm.h> 32 33 #include <sound/pcm_params.h> ··· 278 277 unsigned int codec_not_ready_bits; /* for codec detection */ 279 278 280 279 int spdif_over_aclink; /* passed from the module option */ 281 - struct semaphore open_mutex; /* playback open mutex */ 280 + struct mutex open_mutex; /* playback open mutex */ 282 281 }; 283 282 284 283 ··· 1052 1051 struct atiixp *chip = snd_pcm_substream_chip(substream); 1053 1052 int err; 1054 1053 1055 - down(&chip->open_mutex); 1054 + mutex_lock(&chip->open_mutex); 1056 1055 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0); 1057 - up(&chip->open_mutex); 1056 + mutex_unlock(&chip->open_mutex); 1058 1057 if (err < 0) 1059 1058 return err; 1060 1059 substream->runtime->hw.channels_max = chip->max_channels; ··· 1069 1068 { 1070 1069 struct atiixp *chip = snd_pcm_substream_chip(substream); 1071 1070 int err; 1072 - down(&chip->open_mutex); 1071 + mutex_lock(&chip->open_mutex); 1073 1072 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); 1074 - up(&chip->open_mutex); 1073 + mutex_unlock(&chip->open_mutex); 1075 1074 return err; 1076 1075 } 1077 1076 ··· 1091 1090 { 1092 1091 struct atiixp *chip = snd_pcm_substream_chip(substream); 1093 1092 int err; 1094 - down(&chip->open_mutex); 1093 + mutex_lock(&chip->open_mutex); 1095 1094 if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */ 1096 1095 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2); 1097 1096 else 1098 1097 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1); 1099 - up(&chip->open_mutex); 1098 + mutex_unlock(&chip->open_mutex); 1100 1099 return err; 1101 1100 } 1102 1101 ··· 1104 1103 { 1105 1104 struct atiixp *chip = snd_pcm_substream_chip(substream); 1106 1105 int err; 1107 - down(&chip->open_mutex); 1106 + mutex_lock(&chip->open_mutex); 1108 1107 if (chip->spdif_over_aclink) 1109 1108 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); 1110 1109 else 1111 1110 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]); 1112 - up(&chip->open_mutex); 1111 + mutex_unlock(&chip->open_mutex); 1113 1112 return err; 1114 1113 } 1115 1114 ··· 1561 1560 } 1562 1561 1563 1562 spin_lock_init(&chip->reg_lock); 1564 - init_MUTEX(&chip->open_mutex); 1563 + mutex_init(&chip->open_mutex); 1565 1564 chip->card = card; 1566 1565 chip->pci = pci; 1567 1566 chip->irq = -1;
+7 -6
sound/pci/atiixp_modem.c
··· 27 27 #include <linux/pci.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/moduleparam.h> 30 + #include <linux/mutex.h> 30 31 #include <sound/core.h> 31 32 #include <sound/pcm.h> 32 33 #include <sound/pcm_params.h> ··· 256 255 unsigned int codec_not_ready_bits; /* for codec detection */ 257 256 258 257 int spdif_over_aclink; /* passed from the module option */ 259 - struct semaphore open_mutex; /* playback open mutex */ 258 + struct mutex open_mutex; /* playback open mutex */ 260 259 }; 261 260 262 261 ··· 912 911 struct atiixp_modem *chip = snd_pcm_substream_chip(substream); 913 912 int err; 914 913 915 - down(&chip->open_mutex); 914 + mutex_lock(&chip->open_mutex); 916 915 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0); 917 - up(&chip->open_mutex); 916 + mutex_unlock(&chip->open_mutex); 918 917 if (err < 0) 919 918 return err; 920 919 return 0; ··· 924 923 { 925 924 struct atiixp_modem *chip = snd_pcm_substream_chip(substream); 926 925 int err; 927 - down(&chip->open_mutex); 926 + mutex_lock(&chip->open_mutex); 928 927 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); 929 - up(&chip->open_mutex); 928 + mutex_unlock(&chip->open_mutex); 930 929 return err; 931 930 } 932 931 ··· 1234 1233 } 1235 1234 1236 1235 spin_lock_init(&chip->reg_lock); 1237 - init_MUTEX(&chip->open_mutex); 1236 + mutex_init(&chip->open_mutex); 1238 1237 chip->card = card; 1239 1238 chip->pci = pci; 1240 1239 chip->irq = -1;
+13 -12
sound/pci/cmipci.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/gameport.h> 31 31 #include <linux/moduleparam.h> 32 + #include <linux/mutex.h> 32 33 #include <sound/core.h> 33 34 #include <sound/info.h> 34 35 #include <sound/control.h> ··· 440 439 struct snd_pcm_hardware *hw_info[3]; /* for playbacks */ 441 440 442 441 int opened[2]; /* open mode */ 443 - struct semaphore open_mutex; 442 + struct mutex open_mutex; 444 443 445 444 unsigned int mixer_insensitive: 1; 446 445 struct snd_kcontrol *mixer_res_ctl[CM_SAVED_MIXERS]; ··· 642 641 { 643 642 struct cmipci *cm = snd_pcm_substream_chip(substream); 644 643 if (params_channels(hw_params) > 2) { 645 - down(&cm->open_mutex); 644 + mutex_lock(&cm->open_mutex); 646 645 if (cm->opened[CM_CH_PLAY]) { 647 - up(&cm->open_mutex); 646 + mutex_unlock(&cm->open_mutex); 648 647 return -EBUSY; 649 648 } 650 649 /* reserve the channel A */ 651 650 cm->opened[CM_CH_PLAY] = CM_OPEN_PLAYBACK_MULTI; 652 - up(&cm->open_mutex); 651 + mutex_unlock(&cm->open_mutex); 653 652 } 654 653 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 655 654 } ··· 1462 1461 * pcm framework doesn't pass file pointer before actually opened, 1463 1462 * we can't know whether blocking mode or not in open callback.. 1464 1463 */ 1465 - down(&cm->open_mutex); 1464 + mutex_lock(&cm->open_mutex); 1466 1465 if (cm->opened[ch]) { 1467 - up(&cm->open_mutex); 1466 + mutex_unlock(&cm->open_mutex); 1468 1467 return -EBUSY; 1469 1468 } 1470 1469 cm->opened[ch] = mode; ··· 1476 1475 snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_ENDBDAC); 1477 1476 spin_unlock_irq(&cm->reg_lock); 1478 1477 } 1479 - up(&cm->open_mutex); 1478 + mutex_unlock(&cm->open_mutex); 1480 1479 return 0; 1481 1480 } 1482 1481 ··· 1484 1483 { 1485 1484 int ch = mode & CM_OPEN_CH_MASK; 1486 1485 1487 - down(&cm->open_mutex); 1486 + mutex_lock(&cm->open_mutex); 1488 1487 if (cm->opened[ch] == mode) { 1489 1488 if (cm->channel[ch].substream) { 1490 1489 snd_cmipci_ch_reset(cm, ch); ··· 1500 1499 spin_unlock_irq(&cm->reg_lock); 1501 1500 } 1502 1501 } 1503 - up(&cm->open_mutex); 1502 + mutex_unlock(&cm->open_mutex); 1504 1503 } 1505 1504 1506 1505 /* ··· 1547 1546 if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */ 1548 1547 return err; 1549 1548 runtime->hw = snd_cmipci_playback2; 1550 - down(&cm->open_mutex); 1549 + mutex_lock(&cm->open_mutex); 1551 1550 if (! cm->opened[CM_CH_PLAY]) { 1552 1551 if (cm->can_multi_ch) { 1553 1552 runtime->hw.channels_max = cm->max_channels; ··· 1560 1559 } 1561 1560 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000); 1562 1561 } 1563 - up(&cm->open_mutex); 1562 + mutex_unlock(&cm->open_mutex); 1564 1563 return 0; 1565 1564 } 1566 1565 ··· 2845 2844 } 2846 2845 2847 2846 spin_lock_init(&cm->reg_lock); 2848 - init_MUTEX(&cm->open_mutex); 2847 + mutex_init(&cm->open_mutex); 2849 2848 cm->device = pci->device; 2850 2849 cm->card = card; 2851 2850 cm->pci = pci;
+27 -25
sound/pci/cs46xx/cs46xx_lib.c
··· 53 53 #include <linux/interrupt.h> 54 54 #include <linux/slab.h> 55 55 #include <linux/gameport.h> 56 + #include <linux/mutex.h> 57 + 56 58 57 59 #include <sound/core.h> 58 60 #include <sound/control.h> ··· 911 909 #ifdef CONFIG_SND_CS46XX_NEW_DSP 912 910 snd_assert (sample_rate != 0, return -ENXIO); 913 911 914 - down (&chip->spos_mutex); 912 + mutex_lock(&chip->spos_mutex); 915 913 916 914 if (_cs46xx_adjust_sample_rate (chip,cpcm,sample_rate)) { 917 - up (&chip->spos_mutex); 915 + mutex_unlock(&chip->spos_mutex); 918 916 return -ENXIO; 919 917 } 920 918 921 919 snd_assert (cpcm->pcm_channel != NULL); 922 920 if (!cpcm->pcm_channel) { 923 - up (&chip->spos_mutex); 921 + mutex_unlock(&chip->spos_mutex); 924 922 return -ENXIO; 925 923 } 926 924 927 925 928 926 if (cs46xx_dsp_pcm_channel_set_period (chip,cpcm->pcm_channel,period_size)) { 929 - up (&chip->spos_mutex); 927 + mutex_unlock(&chip->spos_mutex); 930 928 return -EINVAL; 931 929 } 932 930 ··· 967 965 } 968 966 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) { 969 967 #ifdef CONFIG_SND_CS46XX_NEW_DSP 970 - up (&chip->spos_mutex); 968 + mutex_unlock(&chip->spos_mutex); 971 969 #endif 972 970 return err; 973 971 } ··· 991 989 } 992 990 993 991 #ifdef CONFIG_SND_CS46XX_NEW_DSP 994 - up (&chip->spos_mutex); 992 + mutex_unlock(&chip->spos_mutex); 995 993 #endif 996 994 997 995 return 0; ··· 1321 1319 1322 1320 cpcm->substream = substream; 1323 1321 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1324 - down (&chip->spos_mutex); 1322 + mutex_lock(&chip->spos_mutex); 1325 1323 cpcm->pcm_channel = NULL; 1326 1324 cpcm->pcm_channel_id = pcm_channel_id; 1327 1325 ··· 1330 1328 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 1331 1329 &hw_constraints_period_sizes); 1332 1330 1333 - up (&chip->spos_mutex); 1331 + mutex_unlock(&chip->spos_mutex); 1334 1332 #else 1335 1333 chip->playback_pcm = cpcm; /* HACK */ 1336 1334 #endif ··· 1369 1367 1370 1368 snd_printdd("open raw iec958 channel\n"); 1371 1369 1372 - down (&chip->spos_mutex); 1370 + mutex_lock(&chip->spos_mutex); 1373 1371 cs46xx_iec958_pre_open (chip); 1374 - up (&chip->spos_mutex); 1372 + mutex_unlock(&chip->spos_mutex); 1375 1373 1376 1374 return _cs46xx_playback_open_channel(substream,DSP_IEC958_CHANNEL); 1377 1375 } ··· 1387 1385 1388 1386 err = snd_cs46xx_playback_close(substream); 1389 1387 1390 - down (&chip->spos_mutex); 1388 + mutex_lock(&chip->spos_mutex); 1391 1389 cs46xx_iec958_post_close (chip); 1392 - up (&chip->spos_mutex); 1390 + mutex_unlock(&chip->spos_mutex); 1393 1391 1394 1392 return err; 1395 1393 } ··· 1430 1428 if (!cpcm) return -ENXIO; 1431 1429 1432 1430 #ifdef CONFIG_SND_CS46XX_NEW_DSP 1433 - down (&chip->spos_mutex); 1431 + mutex_lock(&chip->spos_mutex); 1434 1432 if (cpcm->pcm_channel) { 1435 1433 cs46xx_dsp_destroy_pcm_channel(chip,cpcm->pcm_channel); 1436 1434 cpcm->pcm_channel = NULL; 1437 1435 } 1438 - up (&chip->spos_mutex); 1436 + mutex_unlock(&chip->spos_mutex); 1439 1437 #else 1440 1438 chip->playback_pcm = NULL; 1441 1439 #endif ··· 1850 1848 1851 1849 switch (kcontrol->private_value) { 1852 1850 case CS46XX_MIXER_SPDIF_OUTPUT_ELEMENT: 1853 - down (&chip->spos_mutex); 1851 + mutex_lock(&chip->spos_mutex); 1854 1852 change = (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED); 1855 1853 if (ucontrol->value.integer.value[0] && !change) 1856 1854 cs46xx_dsp_enable_spdif_out(chip); ··· 1858 1856 cs46xx_dsp_disable_spdif_out(chip); 1859 1857 1860 1858 res = (change != (chip->dsp_spos_instance->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED)); 1861 - up (&chip->spos_mutex); 1859 + mutex_unlock(&chip->spos_mutex); 1862 1860 break; 1863 1861 case CS46XX_MIXER_SPDIF_INPUT_ELEMENT: 1864 1862 change = chip->dsp_spos_instance->spdif_status_in; ··· 1999 1997 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 2000 1998 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2001 1999 2002 - down (&chip->spos_mutex); 2000 + mutex_lock(&chip->spos_mutex); 2003 2001 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_default >> 24) & 0xff); 2004 2002 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_default >> 16) & 0xff); 2005 2003 ucontrol->value.iec958.status[2] = 0; 2006 2004 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_default) & 0xff); 2007 - up (&chip->spos_mutex); 2005 + mutex_unlock(&chip->spos_mutex); 2008 2006 2009 2007 return 0; 2010 2008 } ··· 2017 2015 unsigned int val; 2018 2016 int change; 2019 2017 2020 - down (&chip->spos_mutex); 2018 + mutex_lock(&chip->spos_mutex); 2021 2019 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2022 2020 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[2]) << 16) | 2023 2021 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | ··· 2031 2029 if ( !(ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN) ) 2032 2030 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2033 2031 2034 - up (&chip->spos_mutex); 2032 + mutex_unlock(&chip->spos_mutex); 2035 2033 2036 2034 return change; 2037 2035 } ··· 2052 2050 struct snd_cs46xx *chip = snd_kcontrol_chip(kcontrol); 2053 2051 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 2054 2052 2055 - down (&chip->spos_mutex); 2053 + mutex_lock(&chip->spos_mutex); 2056 2054 ucontrol->value.iec958.status[0] = _wrap_all_bits((ins->spdif_csuv_stream >> 24) & 0xff); 2057 2055 ucontrol->value.iec958.status[1] = _wrap_all_bits((ins->spdif_csuv_stream >> 16) & 0xff); 2058 2056 ucontrol->value.iec958.status[2] = 0; 2059 2057 ucontrol->value.iec958.status[3] = _wrap_all_bits((ins->spdif_csuv_stream) & 0xff); 2060 - up (&chip->spos_mutex); 2058 + mutex_unlock(&chip->spos_mutex); 2061 2059 2062 2060 return 0; 2063 2061 } ··· 2070 2068 unsigned int val; 2071 2069 int change; 2072 2070 2073 - down (&chip->spos_mutex); 2071 + mutex_lock(&chip->spos_mutex); 2074 2072 val = ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[0]) << 24) | 2075 2073 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[1]) << 16) | 2076 2074 ((unsigned int)_wrap_all_bits(ucontrol->value.iec958.status[3])) | ··· 2084 2082 if ( ins->spdif_status_out & DSP_SPDIF_STATUS_PLAYBACK_OPEN ) 2085 2083 cs46xx_poke_via_dsp (chip,SP_SPDOUT_CSUV,val); 2086 2084 2087 - up (&chip->spos_mutex); 2085 + mutex_unlock(&chip->spos_mutex); 2088 2086 2089 2087 return change; 2090 2088 } ··· 3757 3755 } 3758 3756 spin_lock_init(&chip->reg_lock); 3759 3757 #ifdef CONFIG_SND_CS46XX_NEW_DSP 3760 - init_MUTEX(&chip->spos_mutex); 3758 + mutex_init(&chip->spos_mutex); 3761 3759 #endif 3762 3760 chip->card = card; 3763 3761 chip->pci = pci;
+30 -28
sound/pci/cs46xx/dsp_spos.c
··· 28 28 #include <linux/init.h> 29 29 #include <linux/slab.h> 30 30 #include <linux/vmalloc.h> 31 + #include <linux/mutex.h> 32 + 31 33 #include <sound/core.h> 32 34 #include <sound/control.h> 33 35 #include <sound/info.h> ··· 289 287 290 288 snd_assert(ins != NULL, return); 291 289 292 - down(&chip->spos_mutex); 290 + mutex_lock(&chip->spos_mutex); 293 291 for (i = 0; i < ins->nscb; ++i) { 294 292 if (ins->scbs[i].deleted) continue; 295 293 ··· 300 298 vfree(ins->symbol_table.symbols); 301 299 kfree(ins->modules); 302 300 kfree(ins); 303 - up(&chip->spos_mutex); 301 + mutex_unlock(&chip->spos_mutex); 304 302 } 305 303 306 304 int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * module) ··· 499 497 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 500 498 int i,j; 501 499 502 - down(&chip->spos_mutex); 500 + mutex_lock(&chip->spos_mutex); 503 501 snd_iprintf(buffer, "MODULES:\n"); 504 502 for ( i = 0; i < ins->nmodules; ++i ) { 505 503 snd_iprintf(buffer, "\n%s:\n", ins->modules[i].module_name); ··· 512 510 desc->segment_type,desc->offset, desc->size); 513 511 } 514 512 } 515 - up(&chip->spos_mutex); 513 + mutex_unlock(&chip->spos_mutex); 516 514 } 517 515 518 516 static void cs46xx_dsp_proc_task_tree_read (struct snd_info_entry *entry, ··· 523 521 int i, j, col; 524 522 void __iomem *dst = chip->region.idx[1].remap_addr + DSP_PARAMETER_BYTE_OFFSET; 525 523 526 - down(&chip->spos_mutex); 524 + mutex_lock(&chip->spos_mutex); 527 525 snd_iprintf(buffer, "TASK TREES:\n"); 528 526 for ( i = 0; i < ins->ntask; ++i) { 529 527 snd_iprintf(buffer,"\n%04x %s:\n",ins->tasks[i].address,ins->tasks[i].task_name); ··· 540 538 } 541 539 542 540 snd_iprintf(buffer,"\n"); 543 - up(&chip->spos_mutex); 541 + mutex_unlock(&chip->spos_mutex); 544 542 } 545 543 546 544 static void cs46xx_dsp_proc_scb_read (struct snd_info_entry *entry, ··· 550 548 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 551 549 int i; 552 550 553 - down(&chip->spos_mutex); 551 + mutex_lock(&chip->spos_mutex); 554 552 snd_iprintf(buffer, "SCB's:\n"); 555 553 for ( i = 0; i < ins->nscb; ++i) { 556 554 if (ins->scbs[i].deleted) ··· 573 571 } 574 572 575 573 snd_iprintf(buffer,"\n"); 576 - up(&chip->spos_mutex); 574 + mutex_unlock(&chip->spos_mutex); 577 575 } 578 576 579 577 static void cs46xx_dsp_proc_parameter_dump_read (struct snd_info_entry *entry, ··· 854 852 } 855 853 ins->proc_scb_info_entry = entry; 856 854 857 - down(&chip->spos_mutex); 855 + mutex_lock(&chip->spos_mutex); 858 856 /* register/update SCB's entries on proc */ 859 857 for (i = 0; i < ins->nscb; ++i) { 860 858 if (ins->scbs[i].deleted) continue; 861 859 862 860 cs46xx_dsp_proc_register_scb_desc (chip, (ins->scbs + i)); 863 861 } 864 - up(&chip->spos_mutex); 862 + mutex_unlock(&chip->spos_mutex); 865 863 866 864 return 0; 867 865 } ··· 901 899 ins->proc_task_info_entry = NULL; 902 900 } 903 901 904 - down(&chip->spos_mutex); 902 + mutex_lock(&chip->spos_mutex); 905 903 for (i = 0; i < ins->nscb; ++i) { 906 904 if (ins->scbs[i].deleted) continue; 907 905 cs46xx_dsp_proc_free_scb_desc ( (ins->scbs + i) ); 908 906 } 909 - up(&chip->spos_mutex); 907 + mutex_unlock(&chip->spos_mutex); 910 908 911 909 if (ins->proc_dsp_dir) { 912 910 snd_info_unregister (ins->proc_dsp_dir); ··· 1696 1694 snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL); 1697 1695 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1698 1696 1699 - down(&chip->spos_mutex); 1697 + mutex_lock(&chip->spos_mutex); 1700 1698 1701 1699 if ( ! (ins->spdif_status_out & DSP_SPDIF_STATUS_INPUT_CTRL_ENABLED) ) { 1702 1700 /* time countdown enable */ ··· 1740 1738 1741 1739 /* monitor state */ 1742 1740 ins->spdif_status_in = 1; 1743 - up(&chip->spos_mutex); 1741 + mutex_unlock(&chip->spos_mutex); 1744 1742 1745 1743 return 0; 1746 1744 } ··· 1752 1750 snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL); 1753 1751 snd_assert (ins->spdif_in_src != NULL,return -EINVAL); 1754 1752 1755 - down(&chip->spos_mutex); 1753 + mutex_lock(&chip->spos_mutex); 1756 1754 1757 1755 /* Remove the asynchronous receiver SCB */ 1758 1756 cs46xx_dsp_remove_scb (chip,ins->asynch_rx_scb); ··· 1762 1760 1763 1761 /* monitor state */ 1764 1762 ins->spdif_status_in = 0; 1765 - up(&chip->spos_mutex); 1763 + mutex_unlock(&chip->spos_mutex); 1766 1764 1767 1765 /* restore amplifier */ 1768 1766 chip->active_ctrl(chip, -1); ··· 1778 1776 snd_assert (ins->pcm_input == NULL,return -EINVAL); 1779 1777 snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL); 1780 1778 1781 - down(&chip->spos_mutex); 1779 + mutex_lock(&chip->spos_mutex); 1782 1780 ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR, 1783 1781 "PCMSerialInput_Wave"); 1784 - up(&chip->spos_mutex); 1782 + mutex_unlock(&chip->spos_mutex); 1785 1783 1786 1784 return 0; 1787 1785 } ··· 1792 1790 1793 1791 snd_assert (ins->pcm_input != NULL,return -EINVAL); 1794 1792 1795 - down(&chip->spos_mutex); 1793 + mutex_lock(&chip->spos_mutex); 1796 1794 cs46xx_dsp_remove_scb (chip,ins->pcm_input); 1797 1795 ins->pcm_input = NULL; 1798 - up(&chip->spos_mutex); 1796 + mutex_unlock(&chip->spos_mutex); 1799 1797 1800 1798 return 0; 1801 1799 } ··· 1807 1805 snd_assert (ins->adc_input == NULL,return -EINVAL); 1808 1806 snd_assert (ins->codec_in_scb != NULL,return -EINVAL); 1809 1807 1810 - down(&chip->spos_mutex); 1808 + mutex_lock(&chip->spos_mutex); 1811 1809 ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR, 1812 1810 "PCMSerialInput_ADC"); 1813 - up(&chip->spos_mutex); 1811 + mutex_unlock(&chip->spos_mutex); 1814 1812 1815 1813 return 0; 1816 1814 } ··· 1821 1819 1822 1820 snd_assert (ins->adc_input != NULL,return -EINVAL); 1823 1821 1824 - down(&chip->spos_mutex); 1822 + mutex_lock(&chip->spos_mutex); 1825 1823 cs46xx_dsp_remove_scb (chip,ins->adc_input); 1826 1824 ins->adc_input = NULL; 1827 - up(&chip->spos_mutex); 1825 + mutex_unlock(&chip->spos_mutex); 1828 1826 1829 1827 return 0; 1830 1828 } ··· 1871 1869 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1872 1870 struct dsp_scb_descriptor * scb; 1873 1871 1874 - down(&chip->spos_mutex); 1872 + mutex_lock(&chip->spos_mutex); 1875 1873 1876 1874 /* main output */ 1877 1875 scb = ins->master_mix_scb->sub_list_ptr; ··· 1890 1888 ins->dac_volume_left = left; 1891 1889 ins->dac_volume_right = right; 1892 1890 1893 - up(&chip->spos_mutex); 1891 + mutex_unlock(&chip->spos_mutex); 1894 1892 1895 1893 return 0; 1896 1894 } ··· 1899 1897 { 1900 1898 struct dsp_spos_instance * ins = chip->dsp_spos_instance; 1901 1899 1902 - down(&chip->spos_mutex); 1900 + mutex_lock(&chip->spos_mutex); 1903 1901 1904 1902 if (ins->asynch_rx_scb != NULL) 1905 1903 cs46xx_dsp_scb_set_volume (chip,ins->asynch_rx_scb, ··· 1908 1906 ins->spdif_input_volume_left = left; 1909 1907 ins->spdif_input_volume_right = right; 1910 1908 1911 - up(&chip->spos_mutex); 1909 + mutex_unlock(&chip->spos_mutex); 1912 1910 1913 1911 return 0; 1914 1912 }
+4 -2
sound/pci/cs46xx/dsp_spos_scb_lib.c
··· 28 28 #include <linux/pm.h> 29 29 #include <linux/init.h> 30 30 #include <linux/slab.h> 31 + #include <linux/mutex.h> 32 + 31 33 #include <sound/core.h> 32 34 #include <sound/control.h> 33 35 #include <sound/info.h> ··· 79 77 80 78 ins = chip->dsp_spos_instance; 81 79 82 - down(&chip->spos_mutex); 80 + mutex_lock(&chip->spos_mutex); 83 81 snd_iprintf(buffer,"%04x %s:\n",scb->address,scb->scb_name); 84 82 85 83 for (col = 0,j = 0;j < 0x10; j++,col++) { ··· 107 105 scb->task_entry->address); 108 106 109 107 snd_iprintf(buffer,"index [%d] ref_count [%d]\n",scb->index,scb->ref_count); 110 - up(&chip->spos_mutex); 108 + mutex_unlock(&chip->spos_mutex); 111 109 } 112 110 #endif 113 111
+3 -2
sound/pci/emu10k1/emu10k1_main.c
··· 36 36 #include <linux/pci.h> 37 37 #include <linux/slab.h> 38 38 #include <linux/vmalloc.h> 39 + #include <linux/mutex.h> 40 + 39 41 40 42 #include <sound/core.h> 41 43 #include <sound/emu10k1.h> ··· 1099 1097 spin_lock_init(&emu->voice_lock); 1100 1098 spin_lock_init(&emu->synth_lock); 1101 1099 spin_lock_init(&emu->memblk_lock); 1102 - init_MUTEX(&emu->ptb_lock); 1103 - init_MUTEX(&emu->fx8010.lock); 1100 + mutex_init(&emu->fx8010.lock); 1104 1101 INIT_LIST_HEAD(&emu->mapped_link_head); 1105 1102 INIT_LIST_HEAD(&emu->mapped_order_link_head); 1106 1103 emu->pci = pci;
+12 -10
sound/pci/emu10k1/emufx.c
··· 32 32 #include <linux/slab.h> 33 33 #include <linux/vmalloc.h> 34 34 #include <linux/init.h> 35 + #include <linux/mutex.h> 36 + 35 37 #include <sound/core.h> 36 38 #include <sound/emu10k1.h> 37 39 ··· 876 874 { 877 875 int err = 0; 878 876 879 - down(&emu->fx8010.lock); 877 + mutex_lock(&emu->fx8010.lock); 880 878 if ((err = snd_emu10k1_verify_controls(emu, icode)) < 0) 881 879 goto __error; 882 880 strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name)); ··· 899 897 else 900 898 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); 901 899 __error: 902 - up(&emu->fx8010.lock); 900 + mutex_unlock(&emu->fx8010.lock); 903 901 return err; 904 902 } 905 903 ··· 908 906 { 909 907 int err; 910 908 911 - down(&emu->fx8010.lock); 909 + mutex_lock(&emu->fx8010.lock); 912 910 strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name)); 913 911 /* ok, do the main job */ 914 912 err = snd_emu10k1_gpr_peek(emu, icode); ··· 918 916 err = snd_emu10k1_code_peek(emu, icode); 919 917 if (err >= 0) 920 918 err = snd_emu10k1_list_controls(emu, icode); 921 - up(&emu->fx8010.lock); 919 + mutex_unlock(&emu->fx8010.lock); 922 920 return err; 923 921 } 924 922 ··· 934 932 if (ipcm->channels > 32) 935 933 return -EINVAL; 936 934 pcm = &emu->fx8010.pcm[ipcm->substream]; 937 - down(&emu->fx8010.lock); 935 + mutex_lock(&emu->fx8010.lock); 938 936 spin_lock_irq(&emu->reg_lock); 939 937 if (pcm->opened) { 940 938 err = -EBUSY; ··· 964 962 } 965 963 __error: 966 964 spin_unlock_irq(&emu->reg_lock); 967 - up(&emu->fx8010.lock); 965 + mutex_unlock(&emu->fx8010.lock); 968 966 return err; 969 967 } 970 968 ··· 978 976 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) 979 977 return -EINVAL; 980 978 pcm = &emu->fx8010.pcm[ipcm->substream]; 981 - down(&emu->fx8010.lock); 979 + mutex_lock(&emu->fx8010.lock); 982 980 spin_lock_irq(&emu->reg_lock); 983 981 ipcm->channels = pcm->channels; 984 982 ipcm->tram_start = pcm->tram_start; ··· 994 992 ipcm->res1 = ipcm->res2 = 0; 995 993 ipcm->pad = 0; 996 994 spin_unlock_irq(&emu->reg_lock); 997 - up(&emu->fx8010.lock); 995 + mutex_unlock(&emu->fx8010.lock); 998 996 return err; 999 997 } 1000 998 ··· 2310 2308 return -EPERM; 2311 2309 if (get_user(addr, (unsigned int __user *)argp)) 2312 2310 return -EFAULT; 2313 - down(&emu->fx8010.lock); 2311 + mutex_lock(&emu->fx8010.lock); 2314 2312 res = snd_emu10k1_fx8010_tram_setup(emu, addr); 2315 - up(&emu->fx8010.lock); 2313 + mutex_unlock(&emu->fx8010.lock); 2316 2314 return res; 2317 2315 case SNDRV_EMU10K1_IOCTL_STOP: 2318 2316 if (!capable(CAP_SYS_ADMIN))
+14 -12
sound/pci/emu10k1/memory.c
··· 24 24 #include <sound/driver.h> 25 25 #include <linux/pci.h> 26 26 #include <linux/time.h> 27 + #include <linux/mutex.h> 28 + 27 29 #include <sound/core.h> 28 30 #include <sound/emu10k1.h> 29 31 ··· 304 302 hdr = emu->memhdr; 305 303 snd_assert(hdr, return NULL); 306 304 307 - down(&hdr->block_mutex); 305 + mutex_lock(&hdr->block_mutex); 308 306 blk = search_empty(emu, runtime->dma_bytes); 309 307 if (blk == NULL) { 310 - up(&hdr->block_mutex); 308 + mutex_unlock(&hdr->block_mutex); 311 309 return NULL; 312 310 } 313 311 /* fill buffer addresses but pointers are not stored so that ··· 320 318 if (idx >= sgbuf->pages) { 321 319 printk(KERN_ERR "emu: pages overflow! (%d-%d) for %d\n", 322 320 blk->first_page, blk->last_page, sgbuf->pages); 323 - up(&hdr->block_mutex); 321 + mutex_unlock(&hdr->block_mutex); 324 322 return NULL; 325 323 } 326 324 #endif 327 325 addr = sgbuf->table[idx].addr; 328 326 if (! is_valid_page(emu, addr)) { 329 327 printk(KERN_ERR "emu: failure page = %d\n", idx); 330 - up(&hdr->block_mutex); 328 + mutex_unlock(&hdr->block_mutex); 331 329 return NULL; 332 330 } 333 331 emu->page_addr_table[page] = addr; ··· 339 337 err = snd_emu10k1_memblk_map(emu, blk); 340 338 if (err < 0) { 341 339 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); 342 - up(&hdr->block_mutex); 340 + mutex_unlock(&hdr->block_mutex); 343 341 return NULL; 344 342 } 345 - up(&hdr->block_mutex); 343 + mutex_unlock(&hdr->block_mutex); 346 344 return (struct snd_util_memblk *)blk; 347 345 } 348 346 ··· 371 369 struct snd_emu10k1_memblk *blk; 372 370 struct snd_util_memhdr *hdr = hw->memhdr; 373 371 374 - down(&hdr->block_mutex); 372 + mutex_lock(&hdr->block_mutex); 375 373 blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size); 376 374 if (blk == NULL) { 377 - up(&hdr->block_mutex); 375 + mutex_unlock(&hdr->block_mutex); 378 376 return NULL; 379 377 } 380 378 if (synth_alloc_pages(hw, blk)) { 381 379 __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); 382 - up(&hdr->block_mutex); 380 + mutex_unlock(&hdr->block_mutex); 383 381 return NULL; 384 382 } 385 383 snd_emu10k1_memblk_map(hw, blk); 386 - up(&hdr->block_mutex); 384 + mutex_unlock(&hdr->block_mutex); 387 385 return (struct snd_util_memblk *)blk; 388 386 } 389 387 ··· 398 396 struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk; 399 397 unsigned long flags; 400 398 401 - down(&hdr->block_mutex); 399 + mutex_lock(&hdr->block_mutex); 402 400 spin_lock_irqsave(&emu->memblk_lock, flags); 403 401 if (blk->mapped_page >= 0) 404 402 unmap_memblk(emu, blk); 405 403 spin_unlock_irqrestore(&emu->memblk_lock, flags); 406 404 synth_free_pages(emu, blk); 407 405 __snd_util_mem_free(hdr, memblk); 408 - up(&hdr->block_mutex); 406 + mutex_unlock(&hdr->block_mutex); 409 407 return 0; 410 408 } 411 409
+17 -15
sound/pci/ens1370.c
··· 35 35 #include <linux/slab.h> 36 36 #include <linux/gameport.h> 37 37 #include <linux/moduleparam.h> 38 + #include <linux/mutex.h> 39 + 38 40 #include <sound/core.h> 39 41 #include <sound/control.h> 40 42 #include <sound/pcm.h> ··· 381 379 382 380 struct ensoniq { 383 381 spinlock_t reg_lock; 384 - struct semaphore src_mutex; 382 + struct mutex src_mutex; 385 383 386 384 int irq; 387 385 ··· 611 609 struct ensoniq *ensoniq = ac97->private_data; 612 610 unsigned int t, x; 613 611 614 - down(&ensoniq->src_mutex); 612 + mutex_lock(&ensoniq->src_mutex); 615 613 for (t = 0; t < POLL_COUNT; t++) { 616 614 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { 617 615 /* save the current state for latter */ ··· 636 634 /* restore SRC reg */ 637 635 snd_es1371_wait_src_ready(ensoniq); 638 636 outl(x, ES_REG(ensoniq, 1371_SMPRATE)); 639 - up(&ensoniq->src_mutex); 637 + mutex_unlock(&ensoniq->src_mutex); 640 638 return; 641 639 } 642 640 } 643 - up(&ensoniq->src_mutex); 641 + mutex_unlock(&ensoniq->src_mutex); 644 642 snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", 645 643 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); 646 644 } ··· 652 650 unsigned int t, x, fail = 0; 653 651 654 652 __again: 655 - down(&ensoniq->src_mutex); 653 + mutex_lock(&ensoniq->src_mutex); 656 654 for (t = 0; t < POLL_COUNT; t++) { 657 655 if (!(inl(ES_REG(ensoniq, 1371_CODEC)) & ES_1371_CODEC_WIP)) { 658 656 /* save the current state for latter */ ··· 685 683 /* now wait for the stinkin' data (RDY) */ 686 684 for (t = 0; t < POLL_COUNT; t++) { 687 685 if ((x = inl(ES_REG(ensoniq, 1371_CODEC))) & ES_1371_CODEC_RDY) { 688 - up(&ensoniq->src_mutex); 686 + mutex_unlock(&ensoniq->src_mutex); 689 687 return ES_1371_CODEC_READ(x); 690 688 } 691 689 } 692 - up(&ensoniq->src_mutex); 690 + mutex_unlock(&ensoniq->src_mutex); 693 691 if (++fail > 10) { 694 692 snd_printk(KERN_ERR "codec read timeout (final) " 695 693 "at 0x%lx, reg = 0x%x [0x%x]\n", ··· 700 698 goto __again; 701 699 } 702 700 } 703 - up(&ensoniq->src_mutex); 701 + mutex_unlock(&ensoniq->src_mutex); 704 702 snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", 705 703 ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); 706 704 return 0; ··· 719 717 { 720 718 unsigned int n, truncm, freq, result; 721 719 722 - down(&ensoniq->src_mutex); 720 + mutex_lock(&ensoniq->src_mutex); 723 721 n = rate / 3000; 724 722 if ((1 << n) & ((1 << 15) | (1 << 13) | (1 << 11) | (1 << 9))) 725 723 n--; ··· 744 742 snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); 745 743 snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8); 746 744 snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8); 747 - up(&ensoniq->src_mutex); 745 + mutex_unlock(&ensoniq->src_mutex); 748 746 } 749 747 750 748 static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate) 751 749 { 752 750 unsigned int freq, r; 753 751 754 - down(&ensoniq->src_mutex); 752 + mutex_lock(&ensoniq->src_mutex); 755 753 freq = ((rate << 15) + 1500) / 3000; 756 754 r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | 757 755 ES_1371_DIS_P2 | ES_1371_DIS_R1)) | ··· 765 763 r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | 766 764 ES_1371_DIS_P2 | ES_1371_DIS_R1)); 767 765 outl(r, ES_REG(ensoniq, 1371_SMPRATE)); 768 - up(&ensoniq->src_mutex); 766 + mutex_unlock(&ensoniq->src_mutex); 769 767 } 770 768 771 769 static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate) 772 770 { 773 771 unsigned int freq, r; 774 772 775 - down(&ensoniq->src_mutex); 773 + mutex_lock(&ensoniq->src_mutex); 776 774 freq = ((rate << 15) + 1500) / 3000; 777 775 r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | 778 776 ES_1371_DIS_P1 | ES_1371_DIS_R1)) | ··· 787 785 r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | 788 786 ES_1371_DIS_P1 | ES_1371_DIS_R1)); 789 787 outl(r, ES_REG(ensoniq, 1371_SMPRATE)); 790 - up(&ensoniq->src_mutex); 788 + mutex_unlock(&ensoniq->src_mutex); 791 789 } 792 790 793 791 #endif /* CHIP1371 */ ··· 2125 2123 return -ENOMEM; 2126 2124 } 2127 2125 spin_lock_init(&ensoniq->reg_lock); 2128 - init_MUTEX(&ensoniq->src_mutex); 2126 + mutex_init(&ensoniq->src_mutex); 2129 2127 ensoniq->card = card; 2130 2128 ensoniq->pci = pci; 2131 2129 ensoniq->irq = -1;
+12 -10
sound/pci/es1968.c
··· 103 103 #include <linux/slab.h> 104 104 #include <linux/gameport.h> 105 105 #include <linux/moduleparam.h> 106 + #include <linux/mutex.h> 107 + 106 108 #include <sound/core.h> 107 109 #include <sound/pcm.h> 108 110 #include <sound/mpu401.h> ··· 571 569 u16 maestro_map[32]; 572 570 int bobclient; /* active timer instancs */ 573 571 int bob_freq; /* timer frequency */ 574 - struct semaphore memory_mutex; /* memory lock */ 572 + struct mutex memory_mutex; /* memory lock */ 575 573 576 574 /* APU states */ 577 575 unsigned char apu[NR_APUS]; ··· 1358 1356 struct list_head *p; 1359 1357 int max_size = 0; 1360 1358 1361 - down(&chip->memory_mutex); 1359 + mutex_lock(&chip->memory_mutex); 1362 1360 list_for_each(p, &chip->buf_list) { 1363 1361 struct esm_memory *buf = list_entry(p, struct esm_memory, list); 1364 1362 if (buf->empty && buf->buf.bytes > max_size) 1365 1363 max_size = buf->buf.bytes; 1366 1364 } 1367 - up(&chip->memory_mutex); 1365 + mutex_unlock(&chip->memory_mutex); 1368 1366 if (max_size >= 128*1024) 1369 1367 max_size = 127*1024; 1370 1368 return max_size; ··· 1377 1375 struct list_head *p; 1378 1376 1379 1377 size = ((size + ESM_MEM_ALIGN - 1) / ESM_MEM_ALIGN) * ESM_MEM_ALIGN; 1380 - down(&chip->memory_mutex); 1378 + mutex_lock(&chip->memory_mutex); 1381 1379 list_for_each(p, &chip->buf_list) { 1382 1380 buf = list_entry(p, struct esm_memory, list); 1383 1381 if (buf->empty && buf->buf.bytes >= size) 1384 1382 goto __found; 1385 1383 } 1386 - up(&chip->memory_mutex); 1384 + mutex_unlock(&chip->memory_mutex); 1387 1385 return NULL; 1388 1386 1389 1387 __found: 1390 1388 if (buf->buf.bytes > size) { 1391 1389 struct esm_memory *chunk = kmalloc(sizeof(*chunk), GFP_KERNEL); 1392 1390 if (chunk == NULL) { 1393 - up(&chip->memory_mutex); 1391 + mutex_unlock(&chip->memory_mutex); 1394 1392 return NULL; 1395 1393 } 1396 1394 chunk->buf = buf->buf; ··· 1402 1400 list_add(&chunk->list, &buf->list); 1403 1401 } 1404 1402 buf->empty = 0; 1405 - up(&chip->memory_mutex); 1403 + mutex_unlock(&chip->memory_mutex); 1406 1404 return buf; 1407 1405 } 1408 1406 ··· 1411 1409 { 1412 1410 struct esm_memory *chunk; 1413 1411 1414 - down(&chip->memory_mutex); 1412 + mutex_lock(&chip->memory_mutex); 1415 1413 buf->empty = 1; 1416 1414 if (buf->list.prev != &chip->buf_list) { 1417 1415 chunk = list_entry(buf->list.prev, struct esm_memory, list); ··· 1430 1428 kfree(chunk); 1431 1429 } 1432 1430 } 1433 - up(&chip->memory_mutex); 1431 + mutex_unlock(&chip->memory_mutex); 1434 1432 } 1435 1433 1436 1434 static void snd_es1968_free_dmabuf(struct es1968 *chip) ··· 2581 2579 INIT_LIST_HEAD(&chip->buf_list); 2582 2580 INIT_LIST_HEAD(&chip->substream_list); 2583 2581 spin_lock_init(&chip->ac97_lock); 2584 - init_MUTEX(&chip->memory_mutex); 2582 + mutex_init(&chip->memory_mutex); 2585 2583 tasklet_init(&chip->hwvol_tq, es1968_update_hw_volume, (unsigned long)chip); 2586 2584 chip->card = card; 2587 2585 chip->pci = pci;
+26 -25
sound/pci/hda/hda_codec.c
··· 25 25 #include <linux/slab.h> 26 26 #include <linux/pci.h> 27 27 #include <linux/moduleparam.h> 28 + #include <linux/mutex.h> 28 29 #include <sound/core.h> 29 30 #include "hda_codec.h" 30 31 #include <sound/asoundef.h> ··· 77 76 unsigned int verb, unsigned int parm) 78 77 { 79 78 unsigned int res; 80 - down(&codec->bus->cmd_mutex); 79 + mutex_lock(&codec->bus->cmd_mutex); 81 80 if (! codec->bus->ops.command(codec, nid, direct, verb, parm)) 82 81 res = codec->bus->ops.get_response(codec); 83 82 else 84 83 res = (unsigned int)-1; 85 - up(&codec->bus->cmd_mutex); 84 + mutex_unlock(&codec->bus->cmd_mutex); 86 85 return res; 87 86 } 88 87 ··· 102 101 unsigned int verb, unsigned int parm) 103 102 { 104 103 int err; 105 - down(&codec->bus->cmd_mutex); 104 + mutex_lock(&codec->bus->cmd_mutex); 106 105 err = codec->bus->ops.command(codec, nid, direct, verb, parm); 107 - up(&codec->bus->cmd_mutex); 106 + mutex_unlock(&codec->bus->cmd_mutex); 108 107 return err; 109 108 } 110 109 ··· 372 371 bus->modelname = temp->modelname; 373 372 bus->ops = temp->ops; 374 373 375 - init_MUTEX(&bus->cmd_mutex); 374 + mutex_init(&bus->cmd_mutex); 376 375 INIT_LIST_HEAD(&bus->codec_list); 377 376 378 377 if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { ··· 524 523 525 524 codec->bus = bus; 526 525 codec->addr = codec_addr; 527 - init_MUTEX(&codec->spdif_mutex); 526 + mutex_init(&codec->spdif_mutex); 528 527 init_amp_hash(codec); 529 528 530 529 list_add_tail(&codec->list, &bus->codec_list); ··· 882 881 unsigned long pval; 883 882 int err; 884 883 885 - down(&codec->spdif_mutex); /* reuse spdif_mutex */ 884 + mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 886 885 pval = kcontrol->private_value; 887 886 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ 888 887 err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 889 888 kcontrol->private_value = pval; 890 - up(&codec->spdif_mutex); 889 + mutex_unlock(&codec->spdif_mutex); 891 890 return err; 892 891 } 893 892 ··· 897 896 unsigned long pval; 898 897 int i, indices, err = 0, change = 0; 899 898 900 - down(&codec->spdif_mutex); /* reuse spdif_mutex */ 899 + mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 901 900 pval = kcontrol->private_value; 902 901 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; 903 902 for (i = 0; i < indices; i++) { ··· 908 907 change |= err; 909 908 } 910 909 kcontrol->private_value = pval; 911 - up(&codec->spdif_mutex); 910 + mutex_unlock(&codec->spdif_mutex); 912 911 return err < 0 ? err : change; 913 912 } 914 913 ··· 1012 1011 unsigned short val; 1013 1012 int change; 1014 1013 1015 - down(&codec->spdif_mutex); 1014 + mutex_lock(&codec->spdif_mutex); 1016 1015 codec->spdif_status = ucontrol->value.iec958.status[0] | 1017 1016 ((unsigned int)ucontrol->value.iec958.status[1] << 8) | 1018 1017 ((unsigned int)ucontrol->value.iec958.status[2] << 16) | ··· 1027 1026 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_2, val >> 8); 1028 1027 } 1029 1028 1030 - up(&codec->spdif_mutex); 1029 + mutex_unlock(&codec->spdif_mutex); 1031 1030 return change; 1032 1031 } 1033 1032 ··· 1055 1054 unsigned short val; 1056 1055 int change; 1057 1056 1058 - down(&codec->spdif_mutex); 1057 + mutex_lock(&codec->spdif_mutex); 1059 1058 val = codec->spdif_ctls & ~1; 1060 1059 if (ucontrol->value.integer.value[0]) 1061 1060 val |= 1; ··· 1067 1066 AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | 1068 1067 AC_AMP_SET_OUTPUT | ((val & 1) ? 0 : 0x80)); 1069 1068 } 1070 - up(&codec->spdif_mutex); 1069 + mutex_unlock(&codec->spdif_mutex); 1071 1070 return change; 1072 1071 } 1073 1072 ··· 1151 1150 unsigned int val = !!ucontrol->value.integer.value[0]; 1152 1151 int change; 1153 1152 1154 - down(&codec->spdif_mutex); 1153 + mutex_lock(&codec->spdif_mutex); 1155 1154 change = codec->spdif_in_enable != val; 1156 1155 if (change || codec->in_resume) { 1157 1156 codec->spdif_in_enable = val; 1158 1157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val); 1159 1158 } 1160 - up(&codec->spdif_mutex); 1159 + mutex_unlock(&codec->spdif_mutex); 1161 1160 return change; 1162 1161 } 1163 1162 ··· 1825 1824 */ 1826 1825 int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout) 1827 1826 { 1828 - down(&codec->spdif_mutex); 1827 + mutex_lock(&codec->spdif_mutex); 1829 1828 if (mout->dig_out_used) { 1830 - up(&codec->spdif_mutex); 1829 + mutex_unlock(&codec->spdif_mutex); 1831 1830 return -EBUSY; /* already being used */ 1832 1831 } 1833 1832 mout->dig_out_used = HDA_DIG_EXCLUSIVE; 1834 - up(&codec->spdif_mutex); 1833 + mutex_unlock(&codec->spdif_mutex); 1835 1834 return 0; 1836 1835 } 1837 1836 ··· 1840 1839 */ 1841 1840 int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout) 1842 1841 { 1843 - down(&codec->spdif_mutex); 1842 + mutex_lock(&codec->spdif_mutex); 1844 1843 mout->dig_out_used = 0; 1845 - up(&codec->spdif_mutex); 1844 + mutex_unlock(&codec->spdif_mutex); 1846 1845 return 0; 1847 1846 } 1848 1847 ··· 1870 1869 int chs = substream->runtime->channels; 1871 1870 int i; 1872 1871 1873 - down(&codec->spdif_mutex); 1872 + mutex_lock(&codec->spdif_mutex); 1874 1873 if (mout->dig_out_nid && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { 1875 1874 if (chs == 2 && 1876 1875 snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && ··· 1884 1883 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); 1885 1884 } 1886 1885 } 1887 - up(&codec->spdif_mutex); 1886 + mutex_unlock(&codec->spdif_mutex); 1888 1887 1889 1888 /* front */ 1890 1889 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format); ··· 1915 1914 snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); 1916 1915 if (mout->hp_nid) 1917 1916 snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); 1918 - down(&codec->spdif_mutex); 1917 + mutex_lock(&codec->spdif_mutex); 1919 1918 if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { 1920 1919 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); 1921 1920 mout->dig_out_used = 0; 1922 1921 } 1923 - up(&codec->spdif_mutex); 1922 + mutex_unlock(&codec->spdif_mutex); 1924 1923 return 0; 1925 1924 } 1926 1925
+2 -2
sound/pci/hda/hda_codec.h
··· 438 438 struct list_head codec_list; 439 439 struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; /* caddr -> codec */ 440 440 441 - struct semaphore cmd_mutex; 441 + struct mutex cmd_mutex; 442 442 443 443 /* unsolicited event queue */ 444 444 struct hda_bus_unsolicited *unsol; ··· 559 559 int amp_info_size; 560 560 struct hda_amp_info *amp_info; 561 561 562 - struct semaphore spdif_mutex; 562 + struct mutex spdif_mutex; 563 563 unsigned int spdif_status; /* IEC958 status bits */ 564 564 unsigned short spdif_ctls; /* SPDIF control bits */ 565 565 unsigned int spdif_in_enable; /* SPDIF input enable? */
+9 -8
sound/pci/hda/hda_intel.c
··· 43 43 #include <linux/init.h> 44 44 #include <linux/slab.h> 45 45 #include <linux/pci.h> 46 + #include <linux/mutex.h> 46 47 #include <sound/core.h> 47 48 #include <sound/initval.h> 48 49 #include "hda_codec.h" ··· 298 297 299 298 /* locks */ 300 299 spinlock_t reg_lock; 301 - struct semaphore open_mutex; 300 + struct mutex open_mutex; 302 301 303 302 /* streams (x num_streams) */ 304 303 struct azx_dev *azx_dev; ··· 994 993 unsigned long flags; 995 994 int err; 996 995 997 - down(&chip->open_mutex); 996 + mutex_lock(&chip->open_mutex); 998 997 azx_dev = azx_assign_device(chip, substream->stream); 999 998 if (azx_dev == NULL) { 1000 - up(&chip->open_mutex); 999 + mutex_unlock(&chip->open_mutex); 1001 1000 return -EBUSY; 1002 1001 } 1003 1002 runtime->hw = azx_pcm_hw; ··· 1009 1008 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1010 1009 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { 1011 1010 azx_release_device(azx_dev); 1012 - up(&chip->open_mutex); 1011 + mutex_unlock(&chip->open_mutex); 1013 1012 return err; 1014 1013 } 1015 1014 spin_lock_irqsave(&chip->reg_lock, flags); ··· 1018 1017 spin_unlock_irqrestore(&chip->reg_lock, flags); 1019 1018 1020 1019 runtime->private_data = azx_dev; 1021 - up(&chip->open_mutex); 1020 + mutex_unlock(&chip->open_mutex); 1022 1021 return 0; 1023 1022 } 1024 1023 ··· 1030 1029 struct azx_dev *azx_dev = get_azx_dev(substream); 1031 1030 unsigned long flags; 1032 1031 1033 - down(&chip->open_mutex); 1032 + mutex_lock(&chip->open_mutex); 1034 1033 spin_lock_irqsave(&chip->reg_lock, flags); 1035 1034 azx_dev->substream = NULL; 1036 1035 azx_dev->running = 0; 1037 1036 spin_unlock_irqrestore(&chip->reg_lock, flags); 1038 1037 azx_release_device(azx_dev); 1039 1038 hinfo->ops.close(hinfo, apcm->codec, substream); 1040 - up(&chip->open_mutex); 1039 + mutex_unlock(&chip->open_mutex); 1041 1040 return 0; 1042 1041 } 1043 1042 ··· 1409 1408 } 1410 1409 1411 1410 spin_lock_init(&chip->reg_lock); 1412 - init_MUTEX(&chip->open_mutex); 1411 + mutex_init(&chip->open_mutex); 1413 1412 chip->card = card; 1414 1413 chip->pci = pci; 1415 1414 chip->irq = -1;
+15 -13
sound/pci/hda/patch_analog.c
··· 23 23 #include <linux/delay.h> 24 24 #include <linux/slab.h> 25 25 #include <linux/pci.h> 26 + #include <linux/mutex.h> 27 + 26 28 #include <sound/core.h> 27 29 #include "hda_codec.h" 28 30 #include "hda_local.h" ··· 62 60 /* PCM information */ 63 61 struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ 64 62 65 - struct semaphore amp_mutex; /* PCM volume/mute control mutex */ 63 + struct mutex amp_mutex; /* PCM volume/mute control mutex */ 66 64 unsigned int spdif_route; 67 65 68 66 /* dynamic controls, init_verbs and input_mux */ ··· 373 371 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 374 372 struct ad198x_spec *ad = codec->spec; 375 373 376 - down(&ad->amp_mutex); 374 + mutex_lock(&ad->amp_mutex); 377 375 snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); 378 - up(&ad->amp_mutex); 376 + mutex_unlock(&ad->amp_mutex); 379 377 return 0; 380 378 } 381 379 ··· 385 383 struct ad198x_spec *ad = codec->spec; 386 384 int i, change = 0; 387 385 388 - down(&ad->amp_mutex); 386 + mutex_lock(&ad->amp_mutex); 389 387 for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { 390 388 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); 391 389 change |= snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); 392 390 } 393 391 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); 394 - up(&ad->amp_mutex); 392 + mutex_unlock(&ad->amp_mutex); 395 393 return change; 396 394 } 397 395 ··· 402 400 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 403 401 struct ad198x_spec *ad = codec->spec; 404 402 405 - down(&ad->amp_mutex); 403 + mutex_lock(&ad->amp_mutex); 406 404 snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 407 - up(&ad->amp_mutex); 405 + mutex_unlock(&ad->amp_mutex); 408 406 return 0; 409 407 } 410 408 ··· 414 412 struct ad198x_spec *ad = codec->spec; 415 413 int i, change = 0; 416 414 417 - down(&ad->amp_mutex); 415 + mutex_lock(&ad->amp_mutex); 418 416 for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { 419 417 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); 420 418 change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); 421 419 } 422 420 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); 423 - up(&ad->amp_mutex); 421 + mutex_unlock(&ad->amp_mutex); 424 422 return change; 425 423 } 426 424 ··· 546 544 if (spec == NULL) 547 545 return -ENOMEM; 548 546 549 - init_MUTEX(&spec->amp_mutex); 547 + mutex_init(&spec->amp_mutex); 550 548 codec->spec = spec; 551 549 552 550 spec->multiout.max_channels = 6; ··· 710 708 if (spec == NULL) 711 709 return -ENOMEM; 712 710 713 - init_MUTEX(&spec->amp_mutex); 711 + mutex_init(&spec->amp_mutex); 714 712 codec->spec = spec; 715 713 716 714 spec->multiout.max_channels = 2; ··· 856 854 if (spec == NULL) 857 855 return -ENOMEM; 858 856 859 - init_MUTEX(&spec->amp_mutex); 857 + mutex_init(&spec->amp_mutex); 860 858 codec->spec = spec; 861 859 862 860 spec->multiout.max_channels = 2; ··· 2034 2032 if (spec == NULL) 2035 2033 return -ENOMEM; 2036 2034 2037 - init_MUTEX(&spec->amp_mutex); 2035 + mutex_init(&spec->amp_mutex); 2038 2036 codec->spec = spec; 2039 2037 2040 2038 if (codec->revision_id == AD1988A_REV2)
+20 -18
sound/pci/ice1712/aureon.c
··· 53 53 #include <linux/interrupt.h> 54 54 #include <linux/init.h> 55 55 #include <linux/slab.h> 56 + #include <linux/mutex.h> 57 + 56 58 #include <sound/core.h> 57 59 58 60 #include "ice1712.h" ··· 212 210 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 213 211 unsigned short vol; 214 212 215 - down(&ice->gpio_mutex); 213 + mutex_lock(&ice->gpio_mutex); 216 214 217 215 vol = aureon_ac97_read(ice, kcontrol->private_value & 0x7F); 218 216 ucontrol->value.integer.value[0] = 0x1F - (vol & 0x1F); 219 217 if (kcontrol->private_value & AUREON_AC97_STEREO) 220 218 ucontrol->value.integer.value[1] = 0x1F - ((vol >> 8) & 0x1F); 221 219 222 - up(&ice->gpio_mutex); 220 + mutex_unlock(&ice->gpio_mutex); 223 221 return 0; 224 222 } 225 223 ··· 254 252 { 255 253 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 256 254 257 - down(&ice->gpio_mutex); 255 + mutex_lock(&ice->gpio_mutex); 258 256 259 257 ucontrol->value.integer.value[0] = aureon_ac97_read(ice, kcontrol->private_value & 0x7F) & 0x8000 ? 0 : 1; 260 258 261 - up(&ice->gpio_mutex); 259 + mutex_unlock(&ice->gpio_mutex); 262 260 return 0; 263 261 } 264 262 ··· 290 288 { 291 289 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 292 290 293 - down(&ice->gpio_mutex); 291 + mutex_lock(&ice->gpio_mutex); 294 292 295 293 ucontrol->value.integer.value[0] = aureon_ac97_read(ice, AC97_MIC) & 0x0020 ? 0 : 1; 296 294 297 - up(&ice->gpio_mutex); 295 + mutex_unlock(&ice->gpio_mutex); 298 296 return 0; 299 297 } 300 298 ··· 490 488 { 491 489 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 492 490 493 - down(&ice->gpio_mutex); 491 + mutex_lock(&ice->gpio_mutex); 494 492 495 493 ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX1) >> 1) & 0x01; 496 494 497 - up(&ice->gpio_mutex); 495 + mutex_unlock(&ice->gpio_mutex); 498 496 return 0; 499 497 } 500 498 ··· 559 557 { 560 558 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 561 559 562 - down(&ice->gpio_mutex); 560 + mutex_lock(&ice->gpio_mutex); 563 561 ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1; 564 - up(&ice->gpio_mutex); 562 + mutex_unlock(&ice->gpio_mutex); 565 563 return 0; 566 564 } 567 565 ··· 784 782 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 785 783 unsigned short val; 786 784 787 - down(&ice->gpio_mutex); 785 + mutex_lock(&ice->gpio_mutex); 788 786 val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; 789 787 val = val > PCM_MIN ? (val - PCM_MIN) : 0; 790 788 ucontrol->value.integer.value[0] = val; 791 - up(&ice->gpio_mutex); 789 + mutex_unlock(&ice->gpio_mutex); 792 790 return 0; 793 791 } 794 792 ··· 829 827 unsigned short val; 830 828 int i; 831 829 832 - down(&ice->gpio_mutex); 830 + mutex_lock(&ice->gpio_mutex); 833 831 for (i = 0; i < 2; i++) { 834 832 val = wm_get(ice, WM_ADC_GAIN + i); 835 833 ucontrol->value.integer.value[i] = ~val>>5 & 0x1; 836 834 } 837 - up(&ice->gpio_mutex); 835 + mutex_unlock(&ice->gpio_mutex); 838 836 return 0; 839 837 } 840 838 ··· 876 874 int i, idx; 877 875 unsigned short vol; 878 876 879 - down(&ice->gpio_mutex); 877 + mutex_lock(&ice->gpio_mutex); 880 878 for (i = 0; i < 2; i++) { 881 879 idx = WM_ADC_GAIN + i; 882 880 vol = wm_get(ice, idx) & 0x1f; 883 881 ucontrol->value.integer.value[i] = vol; 884 882 } 885 - up(&ice->gpio_mutex); 883 + mutex_unlock(&ice->gpio_mutex); 886 884 return 0; 887 885 } 888 886 ··· 953 951 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 954 952 unsigned short val; 955 953 956 - down(&ice->gpio_mutex); 954 + mutex_lock(&ice->gpio_mutex); 957 955 val = wm_get(ice, WM_ADC_MUX); 958 956 ucontrol->value.integer.value[0] = val & 7; 959 957 ucontrol->value.integer.value[1] = (val >> 4) & 7; 960 - up(&ice->gpio_mutex); 958 + mutex_unlock(&ice->gpio_mutex); 961 959 return 0; 962 960 } 963 961
+14 -12
sound/pci/ice1712/delta.c
··· 28 28 #include <linux/interrupt.h> 29 29 #include <linux/init.h> 30 30 #include <linux/slab.h> 31 + #include <linux/mutex.h> 32 + 31 33 #include <sound/core.h> 32 34 #include <sound/cs8427.h> 33 35 #include <sound/asoundef.h> ··· 132 130 int res = count; 133 131 unsigned char tmp; 134 132 135 - down(&ice->gpio_mutex); 133 + mutex_lock(&ice->gpio_mutex); 136 134 tmp = ap_cs8427_codec_select(ice); 137 135 ap_cs8427_write_byte(ice, (device->addr << 1) | 0, tmp); /* address + write mode */ 138 136 while (count-- > 0) 139 137 ap_cs8427_write_byte(ice, *bytes++, tmp); 140 138 ap_cs8427_codec_deassert(ice, tmp); 141 - up(&ice->gpio_mutex); 139 + mutex_unlock(&ice->gpio_mutex); 142 140 return res; 143 141 } 144 142 ··· 149 147 int res = count; 150 148 unsigned char tmp; 151 149 152 - down(&ice->gpio_mutex); 150 + mutex_lock(&ice->gpio_mutex); 153 151 tmp = ap_cs8427_codec_select(ice); 154 152 ap_cs8427_write_byte(ice, (device->addr << 1) | 1, tmp); /* address + read mode */ 155 153 while (count-- > 0) 156 154 *bytes++ = ap_cs8427_read_byte(ice, tmp); 157 155 ap_cs8427_codec_deassert(ice, tmp); 158 - up(&ice->gpio_mutex); 156 + mutex_unlock(&ice->gpio_mutex); 159 157 return res; 160 158 } 161 159 ··· 182 180 /* send byte to transmitter */ 183 181 mask1 = ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK; 184 182 mask2 = ICE1712_DELTA_SPDIF_OUT_STAT_DATA; 185 - down(&ice->gpio_mutex); 183 + mutex_lock(&ice->gpio_mutex); 186 184 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); 187 185 for (idx = 7; idx >= 0; idx--) { 188 186 tmp &= ~(mask1 | mask2); ··· 196 194 } 197 195 tmp &= ~mask1; 198 196 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); 199 - up(&ice->gpio_mutex); 197 + mutex_unlock(&ice->gpio_mutex); 200 198 } 201 199 202 200 ··· 298 296 if (rate == 0) /* no hint - S/PDIF input is master, simply return */ 299 297 return; 300 298 301 - down(&ice->gpio_mutex); 299 + mutex_lock(&ice->gpio_mutex); 302 300 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); 303 301 tmp2 = tmp & ~ICE1712_DELTA_DFS; 304 302 if (rate > 48000) 305 303 tmp2 |= ICE1712_DELTA_DFS; 306 304 if (tmp != tmp2) 307 305 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp2); 308 - up(&ice->gpio_mutex); 306 + mutex_unlock(&ice->gpio_mutex); 309 307 } 310 308 311 309 /* ··· 320 318 return; 321 319 322 320 /* check before reset ak4524 to avoid unnecessary clicks */ 323 - down(&ice->gpio_mutex); 321 + mutex_lock(&ice->gpio_mutex); 324 322 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); 325 - up(&ice->gpio_mutex); 323 + mutex_unlock(&ice->gpio_mutex); 326 324 tmp2 = tmp & ~ICE1712_DELTA_DFS; 327 325 if (rate > 48000) 328 326 tmp2 |= ICE1712_DELTA_DFS; ··· 331 329 332 330 /* do it again */ 333 331 snd_akm4xxx_reset(ak, 1); 334 - down(&ice->gpio_mutex); 332 + mutex_lock(&ice->gpio_mutex); 335 333 tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ~ICE1712_DELTA_DFS; 336 334 if (rate > 48000) 337 335 tmp |= ICE1712_DELTA_DFS; 338 336 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp); 339 - up(&ice->gpio_mutex); 337 + mutex_unlock(&ice->gpio_mutex); 340 338 snd_akm4xxx_reset(ak, 0); 341 339 } 342 340
+14 -12
sound/pci/ice1712/hoontech.c
··· 27 27 #include <linux/interrupt.h> 28 28 #include <linux/init.h> 29 29 #include <linux/slab.h> 30 + #include <linux/mutex.h> 31 + 30 32 #include <sound/core.h> 31 33 32 34 #include "ice1712.h" ··· 50 48 51 49 static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) 52 50 { 53 - down(&ice->gpio_mutex); 51 + mutex_lock(&ice->gpio_mutex); 54 52 ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate); 55 53 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); 56 - up(&ice->gpio_mutex); 54 + mutex_unlock(&ice->gpio_mutex); 57 55 } 58 56 59 57 static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) 60 58 { 61 - down(&ice->gpio_mutex); 59 + mutex_lock(&ice->gpio_mutex); 62 60 ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate); 63 61 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); 64 - up(&ice->gpio_mutex); 62 + mutex_unlock(&ice->gpio_mutex); 65 63 } 66 64 67 65 static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) 68 66 { 69 - down(&ice->gpio_mutex); 67 + mutex_lock(&ice->gpio_mutex); 70 68 ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate); 71 69 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); 72 - up(&ice->gpio_mutex); 70 + mutex_unlock(&ice->gpio_mutex); 73 71 } 74 72 75 73 static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) 76 74 { 77 - down(&ice->gpio_mutex); 75 + mutex_lock(&ice->gpio_mutex); 78 76 79 77 /* select box */ 80 78 ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); ··· 117 115 ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); 118 116 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); 119 117 120 - up(&ice->gpio_mutex); 118 + mutex_unlock(&ice->gpio_mutex); 121 119 } 122 120 123 121 static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) 124 122 { 125 - down(&ice->gpio_mutex); 123 + mutex_lock(&ice->gpio_mutex); 126 124 127 125 /* select box */ 128 126 ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); ··· 143 141 ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); 144 142 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); 145 143 146 - up(&ice->gpio_mutex); 144 + mutex_unlock(&ice->gpio_mutex); 147 145 } 148 146 149 147 static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) 150 148 { 151 - down(&ice->gpio_mutex); 149 + mutex_lock(&ice->gpio_mutex); 152 150 ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate); 153 151 snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); 154 - up(&ice->gpio_mutex); 152 + mutex_unlock(&ice->gpio_mutex); 155 153 } 156 154 157 155 static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
+4 -3
sound/pci/ice1712/ice1712.c
··· 55 55 #include <linux/pci.h> 56 56 #include <linux/slab.h> 57 57 #include <linux/moduleparam.h> 58 + #include <linux/mutex.h> 58 59 #include <sound/core.h> 59 60 #include <sound/cs8427.h> 60 61 #include <sound/info.h> ··· 2558 2557 cs8427_timeout = 1000; 2559 2558 ice->cs8427_timeout = cs8427_timeout; 2560 2559 spin_lock_init(&ice->reg_lock); 2561 - init_MUTEX(&ice->gpio_mutex); 2562 - init_MUTEX(&ice->i2c_mutex); 2563 - init_MUTEX(&ice->open_mutex); 2560 + mutex_init(&ice->gpio_mutex); 2561 + mutex_init(&ice->i2c_mutex); 2562 + mutex_init(&ice->open_mutex); 2564 2563 ice->gpio.set_mask = snd_ice1712_set_gpio_mask; 2565 2564 ice->gpio.set_dir = snd_ice1712_set_gpio_dir; 2566 2565 ice->gpio.set_data = snd_ice1712_set_gpio_data;
+5 -5
sound/pci/ice1712/ice1712.h
··· 334 334 unsigned int num_total_adcs; /* total ADCs */ 335 335 unsigned int cur_rate; /* current rate */ 336 336 337 - struct semaphore open_mutex; 337 + struct mutex open_mutex; 338 338 struct snd_pcm_substream *pcm_reserved[4]; 339 339 struct snd_pcm_hw_constraint_list *hw_rates; /* card-specific rate constraints */ 340 340 ··· 342 342 struct snd_akm4xxx *akm; 343 343 struct snd_ice1712_spdif spdif; 344 344 345 - struct semaphore i2c_mutex; /* I2C mutex for ICE1724 registers */ 345 + struct mutex i2c_mutex; /* I2C mutex for ICE1724 registers */ 346 346 struct snd_i2c_bus *i2c; /* I2C bus */ 347 347 struct snd_i2c_device *cs8427; /* CS8427 I2C device */ 348 348 unsigned int cs8427_timeout; /* CS8427 reset timeout in HZ/100 */ ··· 360 360 void (*set_pro_rate)(struct snd_ice1712 *ice, unsigned int rate); 361 361 void (*i2s_mclk_changed)(struct snd_ice1712 *ice); 362 362 } gpio; 363 - struct semaphore gpio_mutex; 363 + struct mutex gpio_mutex; 364 364 365 365 /* other board-specific data */ 366 366 union { ··· 423 423 */ 424 424 static inline void snd_ice1712_save_gpio_status(struct snd_ice1712 *ice) 425 425 { 426 - down(&ice->gpio_mutex); 426 + mutex_lock(&ice->gpio_mutex); 427 427 ice->gpio.saved[0] = ice->gpio.direction; 428 428 ice->gpio.saved[1] = ice->gpio.write_mask; 429 429 } ··· 434 434 ice->gpio.set_mask(ice, ice->gpio.saved[1]); 435 435 ice->gpio.direction = ice->gpio.saved[0]; 436 436 ice->gpio.write_mask = ice->gpio.saved[1]; 437 - up(&ice->gpio_mutex); 437 + mutex_unlock(&ice->gpio_mutex); 438 438 } 439 439 440 440 /* for bit controls */
+19 -18
sound/pci/ice1712/ice1724.c
··· 30 30 #include <linux/pci.h> 31 31 #include <linux/slab.h> 32 32 #include <linux/moduleparam.h> 33 + #include <linux/mutex.h> 33 34 #include <sound/core.h> 34 35 #include <sound/info.h> 35 36 #include <sound/mpu401.h> ··· 488 487 int i, chs; 489 488 490 489 chs = params_channels(hw_params); 491 - down(&ice->open_mutex); 490 + mutex_lock(&ice->open_mutex); 492 491 /* mark surround channels */ 493 492 if (substream == ice->playback_pro_substream) { 494 493 /* PDMA0 can be multi-channel up to 8 */ ··· 496 495 for (i = 0; i < chs; i++) { 497 496 if (ice->pcm_reserved[i] && 498 497 ice->pcm_reserved[i] != substream) { 499 - up(&ice->open_mutex); 498 + mutex_unlock(&ice->open_mutex); 500 499 return -EBUSY; 501 500 } 502 501 ice->pcm_reserved[i] = substream; ··· 511 510 if (ice->playback_con_substream_ds[i] == substream) { 512 511 if (ice->pcm_reserved[i] && 513 512 ice->pcm_reserved[i] != substream) { 514 - up(&ice->open_mutex); 513 + mutex_unlock(&ice->open_mutex); 515 514 return -EBUSY; 516 515 } 517 516 ice->pcm_reserved[i] = substream; ··· 519 518 } 520 519 } 521 520 } 522 - up(&ice->open_mutex); 521 + mutex_unlock(&ice->open_mutex); 523 522 snd_vt1724_set_pro_rate(ice, params_rate(hw_params), 0); 524 523 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 525 524 } ··· 529 528 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 530 529 int i; 531 530 532 - down(&ice->open_mutex); 531 + mutex_lock(&ice->open_mutex); 533 532 /* unmark surround channels */ 534 533 for (i = 0; i < 3; i++) 535 534 if (ice->pcm_reserved[i] == substream) 536 535 ice->pcm_reserved[i] = NULL; 537 - up(&ice->open_mutex); 536 + mutex_unlock(&ice->open_mutex); 538 537 return snd_pcm_lib_free_pages(substream); 539 538 } 540 539 ··· 779 778 snd_pcm_set_sync(substream); 780 779 snd_pcm_hw_constraint_msbits(runtime, 0, 32, 24); 781 780 set_rate_constraints(ice, substream); 782 - down(&ice->open_mutex); 781 + mutex_lock(&ice->open_mutex); 783 782 /* calculate the currently available channels */ 784 783 for (chs = 0; chs < 3; chs++) { 785 784 if (ice->pcm_reserved[chs]) ··· 789 788 runtime->hw.channels_max = chs; 790 789 if (chs > 2) /* channels must be even */ 791 790 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 2); 792 - up(&ice->open_mutex); 791 + mutex_unlock(&ice->open_mutex); 793 792 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 794 793 VT1724_BUFFER_ALIGN); 795 794 snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, ··· 1129 1128 struct snd_ice1712 *ice = snd_pcm_substream_chip(substream); 1130 1129 struct snd_pcm_runtime *runtime = substream->runtime; 1131 1130 1132 - down(&ice->open_mutex); 1131 + mutex_lock(&ice->open_mutex); 1133 1132 /* already used by PDMA0? */ 1134 1133 if (ice->pcm_reserved[substream->number]) { 1135 - up(&ice->open_mutex); 1134 + mutex_unlock(&ice->open_mutex); 1136 1135 return -EBUSY; /* FIXME: should handle blocking mode properly */ 1137 1136 } 1138 - up(&ice->open_mutex); 1137 + mutex_unlock(&ice->open_mutex); 1139 1138 runtime->private_data = &vt1724_playback_dma_regs[substream->number]; 1140 1139 ice->playback_con_substream_ds[substream->number] = substream; 1141 1140 runtime->hw = snd_vt1724_2ch_stereo; ··· 1979 1978 { 1980 1979 unsigned char val; 1981 1980 1982 - down(&ice->i2c_mutex); 1981 + mutex_lock(&ice->i2c_mutex); 1983 1982 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); 1984 1983 outb(dev & ~VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); 1985 1984 wait_i2c_busy(ice); 1986 1985 val = inb(ICEREG1724(ice, I2C_DATA)); 1987 - up(&ice->i2c_mutex); 1986 + mutex_unlock(&ice->i2c_mutex); 1988 1987 //printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); 1989 1988 return val; 1990 1989 } ··· 1992 1991 void snd_vt1724_write_i2c(struct snd_ice1712 *ice, 1993 1992 unsigned char dev, unsigned char addr, unsigned char data) 1994 1993 { 1995 - down(&ice->i2c_mutex); 1994 + mutex_lock(&ice->i2c_mutex); 1996 1995 wait_i2c_busy(ice); 1997 1996 //printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); 1998 1997 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); 1999 1998 outb(data, ICEREG1724(ice, I2C_DATA)); 2000 1999 outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); 2001 2000 wait_i2c_busy(ice); 2002 - up(&ice->i2c_mutex); 2001 + mutex_unlock(&ice->i2c_mutex); 2003 2002 } 2004 2003 2005 2004 static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, ··· 2230 2229 } 2231 2230 ice->vt1724 = 1; 2232 2231 spin_lock_init(&ice->reg_lock); 2233 - init_MUTEX(&ice->gpio_mutex); 2234 - init_MUTEX(&ice->open_mutex); 2235 - init_MUTEX(&ice->i2c_mutex); 2232 + mutex_init(&ice->gpio_mutex); 2233 + mutex_init(&ice->open_mutex); 2234 + mutex_init(&ice->i2c_mutex); 2236 2235 ice->gpio.set_mask = snd_vt1724_set_gpio_mask; 2237 2236 ice->gpio.set_dir = snd_vt1724_set_gpio_dir; 2238 2237 ice->gpio.set_data = snd_vt1724_set_gpio_data;
+6 -4
sound/pci/ice1712/phase.c
··· 39 39 #include <linux/interrupt.h> 40 40 #include <linux/init.h> 41 41 #include <linux/slab.h> 42 + #include <linux/mutex.h> 43 + 42 44 #include <sound/core.h> 43 45 44 46 #include "ice1712.h" ··· 275 273 { 276 274 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 277 275 278 - down(&ice->gpio_mutex); 276 + mutex_lock(&ice->gpio_mutex); 279 277 ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1; 280 - up(&ice->gpio_mutex); 278 + mutex_unlock(&ice->gpio_mutex); 281 279 return 0; 282 280 } 283 281 ··· 586 584 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 587 585 unsigned short val; 588 586 589 - down(&ice->gpio_mutex); 587 + mutex_lock(&ice->gpio_mutex); 590 588 val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff; 591 589 val = val > PCM_MIN ? (val - PCM_MIN) : 0; 592 590 ucontrol->value.integer.value[0] = val; 593 - up(&ice->gpio_mutex); 591 + mutex_unlock(&ice->gpio_mutex); 594 592 return 0; 595 593 } 596 594
+44 -42
sound/pci/ice1712/pontis.c
··· 27 27 #include <linux/interrupt.h> 28 28 #include <linux/init.h> 29 29 #include <linux/slab.h> 30 + #include <linux/mutex.h> 31 + 30 32 #include <sound/core.h> 31 33 #include <sound/info.h> 32 34 ··· 126 124 unsigned short val; 127 125 int i; 128 126 129 - down(&ice->gpio_mutex); 127 + mutex_lock(&ice->gpio_mutex); 130 128 for (i = 0; i < 2; i++) { 131 129 val = wm_get(ice, WM_DAC_ATTEN_L + i) & 0xff; 132 130 val = val > DAC_MIN ? (val - DAC_MIN) : 0; 133 131 ucontrol->value.integer.value[i] = val; 134 132 } 135 - up(&ice->gpio_mutex); 133 + mutex_unlock(&ice->gpio_mutex); 136 134 return 0; 137 135 } 138 136 ··· 142 140 unsigned short oval, nval; 143 141 int i, idx, change = 0; 144 142 145 - down(&ice->gpio_mutex); 143 + mutex_lock(&ice->gpio_mutex); 146 144 for (i = 0; i < 2; i++) { 147 145 nval = ucontrol->value.integer.value[i]; 148 146 nval = (nval ? (nval + DAC_MIN) : 0) & 0xff; ··· 154 152 change = 1; 155 153 } 156 154 } 157 - up(&ice->gpio_mutex); 155 + mutex_unlock(&ice->gpio_mutex); 158 156 return change; 159 157 } 160 158 ··· 181 179 unsigned short val; 182 180 int i; 183 181 184 - down(&ice->gpio_mutex); 182 + mutex_lock(&ice->gpio_mutex); 185 183 for (i = 0; i < 2; i++) { 186 184 val = wm_get(ice, WM_ADC_ATTEN_L + i) & 0xff; 187 185 val = val > ADC_MIN ? (val - ADC_MIN) : 0; 188 186 ucontrol->value.integer.value[i] = val; 189 187 } 190 - up(&ice->gpio_mutex); 188 + mutex_unlock(&ice->gpio_mutex); 191 189 return 0; 192 190 } 193 191 ··· 197 195 unsigned short ovol, nvol; 198 196 int i, idx, change = 0; 199 197 200 - down(&ice->gpio_mutex); 198 + mutex_lock(&ice->gpio_mutex); 201 199 for (i = 0; i < 2; i++) { 202 200 nvol = ucontrol->value.integer.value[i]; 203 201 nvol = nvol ? (nvol + ADC_MIN) : 0; ··· 208 206 change = 1; 209 207 } 210 208 } 211 - up(&ice->gpio_mutex); 209 + mutex_unlock(&ice->gpio_mutex); 212 210 return change; 213 211 } 214 212 ··· 229 227 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 230 228 int bit = kcontrol->private_value; 231 229 232 - down(&ice->gpio_mutex); 230 + mutex_lock(&ice->gpio_mutex); 233 231 ucontrol->value.integer.value[0] = (wm_get(ice, WM_ADC_MUX) & (1 << bit)) ? 1 : 0; 234 - up(&ice->gpio_mutex); 232 + mutex_unlock(&ice->gpio_mutex); 235 233 return 0; 236 234 } 237 235 ··· 242 240 unsigned short oval, nval; 243 241 int change; 244 242 245 - down(&ice->gpio_mutex); 243 + mutex_lock(&ice->gpio_mutex); 246 244 nval = oval = wm_get(ice, WM_ADC_MUX); 247 245 if (ucontrol->value.integer.value[0]) 248 246 nval |= (1 << bit); ··· 252 250 if (change) { 253 251 wm_put(ice, WM_ADC_MUX, nval); 254 252 } 255 - up(&ice->gpio_mutex); 253 + mutex_unlock(&ice->gpio_mutex); 256 254 return 0; 257 255 } 258 256 ··· 272 270 { 273 271 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 274 272 275 - down(&ice->gpio_mutex); 273 + mutex_lock(&ice->gpio_mutex); 276 274 ucontrol->value.integer.value[0] = (wm_get(ice, WM_OUT_MUX) & 0x04) ? 1 : 0; 277 - up(&ice->gpio_mutex); 275 + mutex_unlock(&ice->gpio_mutex); 278 276 return 0; 279 277 } 280 278 ··· 284 282 unsigned short val, oval; 285 283 int change = 0; 286 284 287 - down(&ice->gpio_mutex); 285 + mutex_lock(&ice->gpio_mutex); 288 286 val = oval = wm_get(ice, WM_OUT_MUX); 289 287 if (ucontrol->value.integer.value[0]) 290 288 val |= 0x04; ··· 294 292 wm_put(ice, WM_OUT_MUX, val); 295 293 change = 1; 296 294 } 297 - up(&ice->gpio_mutex); 295 + mutex_unlock(&ice->gpio_mutex); 298 296 return change; 299 297 } 300 298 ··· 314 312 { 315 313 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 316 314 317 - down(&ice->gpio_mutex); 315 + mutex_lock(&ice->gpio_mutex); 318 316 ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL1) & 0xf0) != 0x90; 319 - up(&ice->gpio_mutex); 317 + mutex_unlock(&ice->gpio_mutex); 320 318 return 0; 321 319 } 322 320 ··· 326 324 unsigned short val, oval; 327 325 int change = 0; 328 326 329 - down(&ice->gpio_mutex); 327 + mutex_lock(&ice->gpio_mutex); 330 328 oval = wm_get(ice, WM_DAC_CTRL1); 331 329 val = oval & 0x0f; 332 330 if (ucontrol->value.integer.value[0]) ··· 338 336 wm_put_nocache(ice, WM_DAC_CTRL1, val); 339 337 change = 1; 340 338 } 341 - up(&ice->gpio_mutex); 339 + mutex_unlock(&ice->gpio_mutex); 342 340 return change; 343 341 } 344 342 ··· 451 449 { 452 450 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 453 451 454 - down(&ice->gpio_mutex); 452 + mutex_lock(&ice->gpio_mutex); 455 453 ucontrol->value.enumerated.item[0] = ice->gpio.saved[0]; 456 - up(&ice->gpio_mutex); 454 + mutex_unlock(&ice->gpio_mutex); 457 455 return 0; 458 456 } 459 457 ··· 463 461 unsigned char val; 464 462 int change = 0; 465 463 466 - down(&ice->gpio_mutex); 464 + mutex_lock(&ice->gpio_mutex); 467 465 if (ucontrol->value.enumerated.item[0] != ice->gpio.saved[0]) { 468 466 ice->gpio.saved[0] = ucontrol->value.enumerated.item[0] & 3; 469 467 val = 0x80 | (ice->gpio.saved[0] << 3); 470 468 spi_write(ice, CS_DEV, 0x04, val); 471 469 change = 1; 472 470 } 473 - up(&ice->gpio_mutex); 471 + mutex_unlock(&ice->gpio_mutex); 474 472 return 0; 475 473 } 476 474 ··· 490 488 static int pontis_gpio_mask_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 491 489 { 492 490 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 493 - down(&ice->gpio_mutex); 491 + mutex_lock(&ice->gpio_mutex); 494 492 /* 4-7 reserved */ 495 493 ucontrol->value.integer.value[0] = (~ice->gpio.write_mask & 0xffff) | 0x00f0; 496 - up(&ice->gpio_mutex); 494 + mutex_unlock(&ice->gpio_mutex); 497 495 return 0; 498 496 } 499 497 ··· 502 500 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 503 501 unsigned int val; 504 502 int changed; 505 - down(&ice->gpio_mutex); 503 + mutex_lock(&ice->gpio_mutex); 506 504 /* 4-7 reserved */ 507 505 val = (~ucontrol->value.integer.value[0] & 0xffff) | 0x00f0; 508 506 changed = val != ice->gpio.write_mask; 509 507 ice->gpio.write_mask = val; 510 - up(&ice->gpio_mutex); 508 + mutex_unlock(&ice->gpio_mutex); 511 509 return changed; 512 510 } 513 511 514 512 static int pontis_gpio_dir_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 515 513 { 516 514 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 517 - down(&ice->gpio_mutex); 515 + mutex_lock(&ice->gpio_mutex); 518 516 /* 4-7 reserved */ 519 517 ucontrol->value.integer.value[0] = ice->gpio.direction & 0xff0f; 520 - up(&ice->gpio_mutex); 518 + mutex_unlock(&ice->gpio_mutex); 521 519 return 0; 522 520 } 523 521 ··· 526 524 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 527 525 unsigned int val; 528 526 int changed; 529 - down(&ice->gpio_mutex); 527 + mutex_lock(&ice->gpio_mutex); 530 528 /* 4-7 reserved */ 531 529 val = ucontrol->value.integer.value[0] & 0xff0f; 532 530 changed = (val != ice->gpio.direction); 533 531 ice->gpio.direction = val; 534 - up(&ice->gpio_mutex); 532 + mutex_unlock(&ice->gpio_mutex); 535 533 return changed; 536 534 } 537 535 538 536 static int pontis_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 539 537 { 540 538 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 541 - down(&ice->gpio_mutex); 539 + mutex_lock(&ice->gpio_mutex); 542 540 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); 543 541 snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask); 544 542 ucontrol->value.integer.value[0] = snd_ice1712_gpio_read(ice) & 0xffff; 545 - up(&ice->gpio_mutex); 543 + mutex_unlock(&ice->gpio_mutex); 546 544 return 0; 547 545 } 548 546 ··· 551 549 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); 552 550 unsigned int val, nval; 553 551 int changed = 0; 554 - down(&ice->gpio_mutex); 552 + mutex_lock(&ice->gpio_mutex); 555 553 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction); 556 554 snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask); 557 555 val = snd_ice1712_gpio_read(ice) & 0xffff; ··· 560 558 snd_ice1712_gpio_write(ice, nval); 561 559 changed = 1; 562 560 } 563 - up(&ice->gpio_mutex); 561 + mutex_unlock(&ice->gpio_mutex); 564 562 return changed; 565 563 } 566 564 ··· 653 651 struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; 654 652 char line[64]; 655 653 unsigned int reg, val; 656 - down(&ice->gpio_mutex); 654 + mutex_lock(&ice->gpio_mutex); 657 655 while (!snd_info_get_line(buffer, line, sizeof(line))) { 658 656 if (sscanf(line, "%x %x", &reg, &val) != 2) 659 657 continue; 660 658 if (reg <= 0x17 && val <= 0xffff) 661 659 wm_put(ice, reg, val); 662 660 } 663 - up(&ice->gpio_mutex); 661 + mutex_unlock(&ice->gpio_mutex); 664 662 } 665 663 666 664 static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) ··· 668 666 struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; 669 667 int reg, val; 670 668 671 - down(&ice->gpio_mutex); 669 + mutex_lock(&ice->gpio_mutex); 672 670 for (reg = 0; reg <= 0x17; reg++) { 673 671 val = wm_get(ice, reg); 674 672 snd_iprintf(buffer, "%02x = %04x\n", reg, val); 675 673 } 676 - up(&ice->gpio_mutex); 674 + mutex_unlock(&ice->gpio_mutex); 677 675 } 678 676 679 677 static void wm_proc_init(struct snd_ice1712 *ice) ··· 692 690 struct snd_ice1712 *ice = (struct snd_ice1712 *)entry->private_data; 693 691 int reg, val; 694 692 695 - down(&ice->gpio_mutex); 693 + mutex_lock(&ice->gpio_mutex); 696 694 for (reg = 0; reg <= 0x26; reg++) { 697 695 val = spi_read(ice, CS_DEV, reg); 698 696 snd_iprintf(buffer, "%02x = %02x\n", reg, val); 699 697 } 700 698 val = spi_read(ice, CS_DEV, 0x7f); 701 699 snd_iprintf(buffer, "%02x = %02x\n", 0x7f, val); 702 - up(&ice->gpio_mutex); 700 + mutex_unlock(&ice->gpio_mutex); 703 701 } 704 702 705 703 static void cs_proc_init(struct snd_ice1712 *ice)
+9 -8
sound/pci/korg1212/korg1212.c
··· 27 27 #include <linux/slab.h> 28 28 #include <linux/wait.h> 29 29 #include <linux/moduleparam.h> 30 + #include <linux/mutex.h> 30 31 31 32 #include <sound/core.h> 32 33 #include <sound/info.h> ··· 326 325 int irq; 327 326 328 327 spinlock_t lock; 329 - struct semaphore open_mutex; 328 + struct mutex open_mutex; 330 329 331 330 struct timer_list timer; /* timer callback for checking ack of stop request */ 332 331 int stop_pending_cnt; /* counter for stop pending check */ ··· 668 667 { 669 668 K1212_DEBUG_PRINTK("K1212_DEBUG: OpenCard [%s] %d\n", 670 669 stateName[korg1212->cardState], korg1212->opencnt); 671 - down(&korg1212->open_mutex); 670 + mutex_lock(&korg1212->open_mutex); 672 671 if (korg1212->opencnt++ == 0) { 673 672 snd_korg1212_TurnOffIdleMonitor(korg1212); 674 673 snd_korg1212_setCardState(korg1212, K1212_STATE_OPEN); 675 674 } 676 675 677 - up(&korg1212->open_mutex); 676 + mutex_unlock(&korg1212->open_mutex); 678 677 return 1; 679 678 } 680 679 ··· 683 682 K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard [%s] %d\n", 684 683 stateName[korg1212->cardState], korg1212->opencnt); 685 684 686 - down(&korg1212->open_mutex); 685 + mutex_lock(&korg1212->open_mutex); 687 686 if (--(korg1212->opencnt)) { 688 - up(&korg1212->open_mutex); 687 + mutex_unlock(&korg1212->open_mutex); 689 688 return 0; 690 689 } 691 690 ··· 696 695 K1212_DEBUG_PRINTK("K1212_DEBUG: CloseCard - RC = %d [%s]\n", 697 696 rc, stateName[korg1212->cardState]); 698 697 if (rc != K1212_CMDRET_Success) { 699 - up(&korg1212->open_mutex); 698 + mutex_unlock(&korg1212->open_mutex); 700 699 return 0; 701 700 } 702 701 } else if (korg1212->cardState > K1212_STATE_SETUP) { ··· 708 707 snd_korg1212_setCardState(korg1212, K1212_STATE_READY); 709 708 } 710 709 711 - up(&korg1212->open_mutex); 710 + mutex_unlock(&korg1212->open_mutex); 712 711 return 0; 713 712 } 714 713 ··· 2180 2179 2181 2180 init_waitqueue_head(&korg1212->wait); 2182 2181 spin_lock_init(&korg1212->lock); 2183 - init_MUTEX(&korg1212->open_mutex); 2182 + mutex_init(&korg1212->open_mutex); 2184 2183 init_timer(&korg1212->timer); 2185 2184 korg1212->timer.function = snd_korg1212_timer_func; 2186 2185 korg1212->timer.data = (unsigned long)korg1212;
+11 -10
sound/pci/mixart/mixart.c
··· 26 26 #include <linux/interrupt.h> 27 27 #include <linux/pci.h> 28 28 #include <linux/moduleparam.h> 29 + #include <linux/mutex.h> 29 30 #include <sound/core.h> 30 31 #include <sound/initval.h> 31 32 #include <sound/info.h> ··· 590 589 /* set up format for the stream */ 591 590 format = params_format(hw); 592 591 593 - down(&mgr->setup_mutex); 592 + mutex_lock(&mgr->setup_mutex); 594 593 595 594 /* update the stream levels */ 596 595 if( stream->pcm_number <= MIXART_PCM_DIGITAL ) { ··· 629 628 bufferinfo[i].available_length, 630 629 subs->number); 631 630 } 632 - up(&mgr->setup_mutex); 631 + mutex_unlock(&mgr->setup_mutex); 633 632 634 633 return err; 635 634 } ··· 701 700 int err = 0; 702 701 int pcm_number; 703 702 704 - down(&mgr->setup_mutex); 703 + mutex_lock(&mgr->setup_mutex); 705 704 706 705 if ( pcm == chip->pcm ) { 707 706 pcm_number = MIXART_PCM_ANALOG; ··· 759 758 } 760 759 761 760 _exit_open: 762 - up(&mgr->setup_mutex); 761 + mutex_unlock(&mgr->setup_mutex); 763 762 764 763 return err; 765 764 } ··· 776 775 int err = 0; 777 776 int pcm_number; 778 777 779 - down(&mgr->setup_mutex); 778 + mutex_lock(&mgr->setup_mutex); 780 779 781 780 if ( pcm == chip->pcm ) { 782 781 pcm_number = MIXART_PCM_ANALOG; ··· 837 836 } 838 837 839 838 _exit_open: 840 - up(&mgr->setup_mutex); 839 + mutex_unlock(&mgr->setup_mutex); 841 840 842 841 return err; 843 842 } ··· 850 849 struct mixart_mgr *mgr = chip->mgr; 851 850 struct mixart_stream *stream = subs->runtime->private_data; 852 851 853 - down(&mgr->setup_mutex); 852 + mutex_lock(&mgr->setup_mutex); 854 853 855 854 snd_printdd("snd_mixart_close C%d/P%d/Sub%d\n", chip->chip_idx, stream->pcm_number, subs->number); 856 855 ··· 869 868 stream->status = MIXART_STREAM_STATUS_FREE; 870 869 stream->substream = NULL; 871 870 872 - up(&mgr->setup_mutex); 871 + mutex_unlock(&mgr->setup_mutex); 873 872 return 0; 874 873 } 875 874 ··· 1336 1335 mgr->msg_fifo_writeptr = 0; 1337 1336 1338 1337 spin_lock_init(&mgr->msg_lock); 1339 - init_MUTEX(&mgr->msg_mutex); 1338 + mutex_init(&mgr->msg_mutex); 1340 1339 init_waitqueue_head(&mgr->msg_sleep); 1341 1340 atomic_set(&mgr->msg_processed, 0); 1342 1341 1343 1342 /* init setup mutex*/ 1344 - init_MUTEX(&mgr->setup_mutex); 1343 + mutex_init(&mgr->setup_mutex); 1345 1344 1346 1345 /* init message taslket */ 1347 1346 tasklet_init(&mgr->msg_taskq, snd_mixart_msg_tasklet, (unsigned long) mgr);
+4 -3
sound/pci/mixart/mixart.h
··· 24 24 #define __SOUND_MIXART_H 25 25 26 26 #include <linux/interrupt.h> 27 + #include <linux/mutex.h> 27 28 #include <sound/pcm.h> 28 29 29 30 #define MIXART_DRIVER_VERSION 0x000100 /* 0.1.0 */ ··· 93 92 94 93 spinlock_t lock; /* interrupt spinlock */ 95 94 spinlock_t msg_lock; /* mailbox spinlock */ 96 - struct semaphore msg_mutex; /* mutex for blocking_requests */ 95 + struct mutex msg_mutex; /* mutex for blocking_requests */ 97 96 98 - struct semaphore setup_mutex; /* mutex used in hw_params, open and close */ 97 + struct mutex setup_mutex; /* mutex used in hw_params, open and close */ 99 98 100 99 /* hardware interface */ 101 100 unsigned int dsp_loaded; /* bit flags of loaded dsp indices */ ··· 108 107 int sample_rate; 109 108 int ref_count_rate; 110 109 111 - struct semaphore mixer_mutex; /* mutex for mixer */ 110 + struct mutex mixer_mutex; /* mutex for mixer */ 112 111 113 112 }; 114 113
+10 -8
sound/pci/mixart/mixart_core.c
··· 22 22 23 23 #include <sound/driver.h> 24 24 #include <linux/interrupt.h> 25 + #include <linux/mutex.h> 26 + 25 27 #include <asm/io.h> 26 28 #include <sound/core.h> 27 29 #include "mixart.h" ··· 241 239 wait_queue_t wait; 242 240 long timeout; 243 241 244 - down(&mgr->msg_mutex); 242 + mutex_lock(&mgr->msg_mutex); 245 243 246 244 init_waitqueue_entry(&wait, current); 247 245 ··· 250 248 err = send_msg(mgr, request, max_resp_size, 1, &msg_frame); /* send and mark the answer pending */ 251 249 if (err) { 252 250 spin_unlock_irq(&mgr->msg_lock); 253 - up(&mgr->msg_mutex); 251 + mutex_unlock(&mgr->msg_mutex); 254 252 return err; 255 253 } 256 254 ··· 262 260 263 261 if (! timeout) { 264 262 /* error - no ack */ 265 - up(&mgr->msg_mutex); 263 + mutex_unlock(&mgr->msg_mutex); 266 264 snd_printk(KERN_ERR "error: no reponse on msg %x\n", msg_frame); 267 265 return -EIO; 268 266 } ··· 278 276 if( request->message_id != resp.message_id ) 279 277 snd_printk(KERN_ERR "REPONSE ERROR!\n"); 280 278 281 - up(&mgr->msg_mutex); 279 + mutex_unlock(&mgr->msg_mutex); 282 280 return err; 283 281 } 284 282 ··· 294 292 snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL); 295 293 snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL); 296 294 297 - down(&mgr->msg_mutex); 295 + mutex_lock(&mgr->msg_mutex); 298 296 299 297 init_waitqueue_entry(&wait, current); 300 298 ··· 303 301 err = send_msg(mgr, request, MSG_DEFAULT_SIZE, 1, &notif_event); /* send and mark the notification event pending */ 304 302 if(err) { 305 303 spin_unlock_irq(&mgr->msg_lock); 306 - up(&mgr->msg_mutex); 304 + mutex_unlock(&mgr->msg_mutex); 307 305 return err; 308 306 } 309 307 ··· 315 313 316 314 if (! timeout) { 317 315 /* error - no ack */ 318 - up(&mgr->msg_mutex); 316 + mutex_unlock(&mgr->msg_mutex); 319 317 snd_printk(KERN_ERR "error: notification %x not received\n", notif_event); 320 318 return -EIO; 321 319 } 322 320 323 - up(&mgr->msg_mutex); 321 + mutex_unlock(&mgr->msg_mutex); 324 322 return 0; 325 323 } 326 324
+27 -25
sound/pci/mixart/mixart_mixer.c
··· 24 24 #include <linux/time.h> 25 25 #include <linux/interrupt.h> 26 26 #include <linux/init.h> 27 + #include <linux/mutex.h> 28 + 27 29 #include <sound/core.h> 28 30 #include "mixart.h" 29 31 #include "mixart_core.h" ··· 355 353 static int mixart_analog_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 356 354 { 357 355 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 358 - down(&chip->mgr->mixer_mutex); 356 + mutex_lock(&chip->mgr->mixer_mutex); 359 357 if(kcontrol->private_value == 0) { /* playback */ 360 358 ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; 361 359 ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; ··· 363 361 ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; 364 362 ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; 365 363 } 366 - up(&chip->mgr->mixer_mutex); 364 + mutex_unlock(&chip->mgr->mixer_mutex); 367 365 return 0; 368 366 } 369 367 ··· 373 371 int changed = 0; 374 372 int is_capture, i; 375 373 376 - down(&chip->mgr->mixer_mutex); 374 + mutex_lock(&chip->mgr->mixer_mutex); 377 375 is_capture = (kcontrol->private_value != 0); 378 376 for(i=0; i<2; i++) { 379 377 int new_volume = ucontrol->value.integer.value[i]; ··· 384 382 } 385 383 } 386 384 if(changed) mixart_update_analog_audio_level(chip, is_capture); 387 - up(&chip->mgr->mixer_mutex); 385 + mutex_unlock(&chip->mgr->mixer_mutex); 388 386 return changed; 389 387 } 390 388 ··· 410 408 { 411 409 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 412 410 413 - down(&chip->mgr->mixer_mutex); 411 + mutex_lock(&chip->mgr->mixer_mutex); 414 412 ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; 415 413 ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; 416 - up(&chip->mgr->mixer_mutex); 414 + mutex_unlock(&chip->mgr->mixer_mutex); 417 415 return 0; 418 416 } 419 417 ··· 421 419 { 422 420 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 423 421 int i, changed = 0; 424 - down(&chip->mgr->mixer_mutex); 422 + mutex_lock(&chip->mgr->mixer_mutex); 425 423 for(i=0; i<2; i++) { 426 424 if(chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { 427 425 chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; ··· 429 427 } 430 428 } 431 429 if(changed) mixart_update_analog_audio_level(chip, 0); /* update playback levels */ 432 - up(&chip->mgr->mixer_mutex); 430 + mutex_unlock(&chip->mgr->mixer_mutex); 433 431 return changed; 434 432 } 435 433 ··· 819 817 int *stored_volume; 820 818 int is_capture = kcontrol->private_value & MIXART_VOL_REC_MASK; 821 819 int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; 822 - down(&chip->mgr->mixer_mutex); 820 + mutex_lock(&chip->mgr->mixer_mutex); 823 821 if(is_capture) { 824 822 if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ 825 823 else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ ··· 830 828 } 831 829 ucontrol->value.integer.value[0] = stored_volume[0]; 832 830 ucontrol->value.integer.value[1] = stored_volume[1]; 833 - up(&chip->mgr->mixer_mutex); 831 + mutex_unlock(&chip->mgr->mixer_mutex); 834 832 return 0; 835 833 } 836 834 ··· 843 841 int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; 844 842 int* stored_volume; 845 843 int i; 846 - down(&chip->mgr->mixer_mutex); 844 + mutex_lock(&chip->mgr->mixer_mutex); 847 845 if(is_capture) { 848 846 if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ 849 847 else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ ··· 862 860 if(is_capture) mixart_update_capture_stream_level(chip, is_aes); 863 861 else mixart_update_playback_stream_level(chip, is_aes, idx); 864 862 } 865 - up(&chip->mgr->mixer_mutex); 863 + mutex_unlock(&chip->mgr->mixer_mutex); 866 864 return changed; 867 865 } 868 866 ··· 882 880 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 883 881 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 884 882 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 885 - down(&chip->mgr->mixer_mutex); 883 + mutex_lock(&chip->mgr->mixer_mutex); 886 884 if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */ 887 885 idx += MIXART_PLAYBACK_STREAMS; 888 886 ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; 889 887 ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; 890 - up(&chip->mgr->mixer_mutex); 888 + mutex_unlock(&chip->mgr->mixer_mutex); 891 889 return 0; 892 890 } 893 891 ··· 899 897 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 900 898 int i, j; 901 899 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 902 - down(&chip->mgr->mixer_mutex); 900 + mutex_lock(&chip->mgr->mixer_mutex); 903 901 j = idx; 904 902 if(is_aes) j += MIXART_PLAYBACK_STREAMS; 905 903 for(i=0; i<2; i++) { ··· 909 907 } 910 908 } 911 909 if(changed) mixart_update_playback_stream_level(chip, is_aes, idx); 912 - up(&chip->mgr->mixer_mutex); 910 + mutex_unlock(&chip->mgr->mixer_mutex); 913 911 return changed; 914 912 } 915 913 ··· 958 956 static int mixart_monitor_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 959 957 { 960 958 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 961 - down(&chip->mgr->mixer_mutex); 959 + mutex_lock(&chip->mgr->mixer_mutex); 962 960 ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; 963 961 ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; 964 - up(&chip->mgr->mixer_mutex); 962 + mutex_unlock(&chip->mgr->mixer_mutex); 965 963 return 0; 966 964 } 967 965 ··· 970 968 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 971 969 int changed = 0; 972 970 int i; 973 - down(&chip->mgr->mixer_mutex); 971 + mutex_lock(&chip->mgr->mixer_mutex); 974 972 for(i=0; i<2; i++) { 975 973 if(chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { 976 974 chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; ··· 978 976 changed = 1; 979 977 } 980 978 } 981 - up(&chip->mgr->mixer_mutex); 979 + mutex_unlock(&chip->mgr->mixer_mutex); 982 980 return changed; 983 981 } 984 982 ··· 997 995 static int mixart_monitor_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 998 996 { 999 997 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 1000 - down(&chip->mgr->mixer_mutex); 998 + mutex_lock(&chip->mgr->mixer_mutex); 1001 999 ucontrol->value.integer.value[0] = chip->monitoring_active[0]; 1002 1000 ucontrol->value.integer.value[1] = chip->monitoring_active[1]; 1003 - up(&chip->mgr->mixer_mutex); 1001 + mutex_unlock(&chip->mgr->mixer_mutex); 1004 1002 return 0; 1005 1003 } 1006 1004 ··· 1009 1007 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 1010 1008 int changed = 0; 1011 1009 int i; 1012 - down(&chip->mgr->mixer_mutex); 1010 + mutex_lock(&chip->mgr->mixer_mutex); 1013 1011 for(i=0; i<2; i++) { 1014 1012 if(chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { 1015 1013 chip->monitoring_active[i] = ucontrol->value.integer.value[i]; ··· 1031 1029 } 1032 1030 } 1033 1031 1034 - up(&chip->mgr->mixer_mutex); 1032 + mutex_unlock(&chip->mgr->mixer_mutex); 1035 1033 return (changed != 0); 1036 1034 } 1037 1035 ··· 1061 1059 struct snd_mixart *chip; 1062 1060 int err, i; 1063 1061 1064 - init_MUTEX(&mgr->mixer_mutex); /* can be in another place */ 1062 + mutex_init(&mgr->mixer_mutex); /* can be in another place */ 1065 1063 1066 1064 for(i=0; i<mgr->num_cards; i++) { 1067 1065 struct snd_kcontrol_new temp;
+9 -7
sound/pci/nm256/nm256.c
··· 32 32 #include <linux/pci.h> 33 33 #include <linux/slab.h> 34 34 #include <linux/moduleparam.h> 35 + #include <linux/mutex.h> 36 + 35 37 #include <sound/core.h> 36 38 #include <sound/info.h> 37 39 #include <sound/control.h> ··· 237 235 int irq_acks; 238 236 irqreturn_t (*interrupt)(int, void *, struct pt_regs *); 239 237 int badintrcount; /* counter to check bogus interrupts */ 240 - struct semaphore irq_mutex; 238 + struct mutex irq_mutex; 241 239 242 240 struct nm256_stream streams[2]; 243 241 ··· 461 459 /* acquire interrupt */ 462 460 static int snd_nm256_acquire_irq(struct nm256 *chip) 463 461 { 464 - down(&chip->irq_mutex); 462 + mutex_lock(&chip->irq_mutex); 465 463 if (chip->irq < 0) { 466 464 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ, 467 465 chip->card->driver, chip)) { 468 466 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); 469 - up(&chip->irq_mutex); 467 + mutex_unlock(&chip->irq_mutex); 470 468 return -EBUSY; 471 469 } 472 470 chip->irq = chip->pci->irq; 473 471 } 474 472 chip->irq_acks++; 475 - up(&chip->irq_mutex); 473 + mutex_unlock(&chip->irq_mutex); 476 474 return 0; 477 475 } 478 476 479 477 /* release interrupt */ 480 478 static void snd_nm256_release_irq(struct nm256 *chip) 481 479 { 482 - down(&chip->irq_mutex); 480 + mutex_lock(&chip->irq_mutex); 483 481 if (chip->irq_acks > 0) 484 482 chip->irq_acks--; 485 483 if (chip->irq_acks == 0 && chip->irq >= 0) { 486 484 free_irq(chip->irq, chip); 487 485 chip->irq = -1; 488 486 } 489 - up(&chip->irq_mutex); 487 + mutex_unlock(&chip->irq_mutex); 490 488 } 491 489 492 490 /* ··· 1409 1407 chip->use_cache = use_cache; 1410 1408 spin_lock_init(&chip->reg_lock); 1411 1409 chip->irq = -1; 1412 - init_MUTEX(&chip->irq_mutex); 1410 + mutex_init(&chip->irq_mutex); 1413 1411 1414 1412 /* store buffer sizes in bytes */ 1415 1413 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = playback_bufsize * 1024;
+19 -17
sound/pci/pcxhr/pcxhr.c
··· 28 28 #include <linux/pci.h> 29 29 #include <linux/delay.h> 30 30 #include <linux/moduleparam.h> 31 + #include <linux/mutex.h> 32 + 31 33 #include <sound/core.h> 32 34 #include <sound/initval.h> 33 35 #include <sound/info.h> ··· 520 518 struct timeval my_tv1, my_tv2; 521 519 do_gettimeofday(&my_tv1); 522 520 #endif 523 - down(&mgr->setup_mutex); 521 + mutex_lock(&mgr->setup_mutex); 524 522 525 523 /* check the pipes concerned and build pipe_array */ 526 524 for (i = 0; i < mgr->num_cards; i++) { ··· 539 537 } 540 538 } 541 539 if (capture_mask == 0 && playback_mask == 0) { 542 - up(&mgr->setup_mutex); 540 + mutex_unlock(&mgr->setup_mutex); 543 541 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : no pipes\n"); 544 542 return; 545 543 } ··· 550 548 /* synchronous stop of all the pipes concerned */ 551 549 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 0); 552 550 if (err) { 553 - up(&mgr->setup_mutex); 551 + mutex_unlock(&mgr->setup_mutex); 554 552 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error stop pipes (P%x C%x)\n", 555 553 playback_mask, capture_mask); 556 554 return; ··· 594 592 /* synchronous start of all the pipes concerned */ 595 593 err = pcxhr_set_pipe_state(mgr, playback_mask, capture_mask, 1); 596 594 if (err) { 597 - up(&mgr->setup_mutex); 595 + mutex_unlock(&mgr->setup_mutex); 598 596 snd_printk(KERN_ERR "pcxhr_trigger_tasklet : error start pipes (P%x C%x)\n", 599 597 playback_mask, capture_mask); 600 598 return; ··· 621 619 } 622 620 spin_unlock_irqrestore(&mgr->lock, flags); 623 621 624 - up(&mgr->setup_mutex); 622 + mutex_unlock(&mgr->setup_mutex); 625 623 626 624 #ifdef CONFIG_SND_DEBUG_DETECT 627 625 do_gettimeofday(&my_tv2); ··· 730 728 } 731 729 */ 732 730 733 - down(&mgr->setup_mutex); 731 + mutex_lock(&mgr->setup_mutex); 734 732 735 733 do { 736 734 /* if the stream was stopped before, format and buffer were reset */ ··· 757 755 } 758 756 } while(0); /* do only once (so we can use break instead of goto) */ 759 757 760 - up(&mgr->setup_mutex); 758 + mutex_unlock(&mgr->setup_mutex); 761 759 762 760 return err; 763 761 } ··· 782 780 /* set up format for the stream */ 783 781 format = params_format(hw); 784 782 785 - down(&mgr->setup_mutex); 783 + mutex_lock(&mgr->setup_mutex); 786 784 787 785 stream->channels = channels; 788 786 stream->format = format; ··· 791 789 /* 792 790 err = pcxhr_set_format(stream); 793 791 if(err) { 794 - up(&mgr->setup_mutex); 792 + mutex_unlock(&mgr->setup_mutex); 795 793 return err; 796 794 } 797 795 */ ··· 803 801 err = pcxhr_update_r_buffer(stream); 804 802 } 805 803 */ 806 - up(&mgr->setup_mutex); 804 + mutex_unlock(&mgr->setup_mutex); 807 805 808 806 return err; 809 807 } ··· 849 847 struct pcxhr_stream *stream; 850 848 int is_capture; 851 849 852 - down(&mgr->setup_mutex); 850 + mutex_lock(&mgr->setup_mutex); 853 851 854 852 /* copy the struct snd_pcm_hardware struct */ 855 853 runtime->hw = pcxhr_caps; ··· 873 871 /* streams in use */ 874 872 snd_printk(KERN_ERR "pcxhr_open chip%d subs%d in use\n", 875 873 chip->chip_idx, subs->number); 876 - up(&mgr->setup_mutex); 874 + mutex_unlock(&mgr->setup_mutex); 877 875 return -EBUSY; 878 876 } 879 877 ··· 889 887 &external_rate) || 890 888 external_rate == 0) { 891 889 /* cannot detect the external clock rate */ 892 - up(&mgr->setup_mutex); 890 + mutex_unlock(&mgr->setup_mutex); 893 891 return -EBUSY; 894 892 } 895 893 runtime->hw.rate_min = runtime->hw.rate_max = external_rate; ··· 907 905 908 906 mgr->ref_count_rate++; 909 907 910 - up(&mgr->setup_mutex); 908 + mutex_unlock(&mgr->setup_mutex); 911 909 return 0; 912 910 } 913 911 ··· 918 916 struct pcxhr_mgr *mgr = chip->mgr; 919 917 struct pcxhr_stream *stream = subs->runtime->private_data; 920 918 921 - down(&mgr->setup_mutex); 919 + mutex_lock(&mgr->setup_mutex); 922 920 923 921 snd_printdd("pcxhr_close chip%d subs%d\n", chip->chip_idx, subs->number); 924 922 ··· 931 929 stream->status = PCXHR_STREAM_STATUS_FREE; 932 930 stream->substream = NULL; 933 931 934 - up(&mgr->setup_mutex); 932 + mutex_unlock(&mgr->setup_mutex); 935 933 936 934 return 0; 937 935 } ··· 1266 1264 spin_lock_init(&mgr->msg_lock); 1267 1265 1268 1266 /* init setup mutex*/ 1269 - init_MUTEX(&mgr->setup_mutex); 1267 + mutex_init(&mgr->setup_mutex); 1270 1268 1271 1269 /* init taslket */ 1272 1270 tasklet_init(&mgr->msg_taskq, pcxhr_msg_tasklet, (unsigned long) mgr);
+3 -2
sound/pci/pcxhr/pcxhr.h
··· 24 24 #define __SOUND_PCXHR_H 25 25 26 26 #include <linux/interrupt.h> 27 + #include <linux/mutex.h> 27 28 #include <sound/pcm.h> 28 29 29 30 #define PCXHR_DRIVER_VERSION 0x000804 /* 0.8.4 */ ··· 77 76 spinlock_t lock; /* interrupt spinlock */ 78 77 spinlock_t msg_lock; /* message spinlock */ 79 78 80 - struct semaphore setup_mutex; /* mutex used in hw_params, open and close */ 81 - struct semaphore mixer_mutex; /* mutex for mixer */ 79 + struct mutex setup_mutex; /* mutex used in hw_params, open and close */ 80 + struct mutex mixer_mutex; /* mutex for mixer */ 82 81 83 82 /* hardware interface */ 84 83 unsigned int dsp_loaded; /* bit flags of loaded dsp indices */
+38 -37
sound/pci/pcxhr/pcxhr_mixer.c
··· 25 25 #include <linux/time.h> 26 26 #include <linux/interrupt.h> 27 27 #include <linux/init.h> 28 + #include <linux/mutex.h> 28 29 #include <sound/core.h> 29 30 #include "pcxhr.h" 30 31 #include "pcxhr_hwdep.h" ··· 93 92 struct snd_ctl_elem_value *ucontrol) 94 93 { 95 94 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 96 - down(&chip->mgr->mixer_mutex); 95 + mutex_lock(&chip->mgr->mixer_mutex); 97 96 if (kcontrol->private_value == 0) { /* playback */ 98 97 ucontrol->value.integer.value[0] = chip->analog_playback_volume[0]; 99 98 ucontrol->value.integer.value[1] = chip->analog_playback_volume[1]; ··· 101 100 ucontrol->value.integer.value[0] = chip->analog_capture_volume[0]; 102 101 ucontrol->value.integer.value[1] = chip->analog_capture_volume[1]; 103 102 } 104 - up(&chip->mgr->mixer_mutex); 103 + mutex_unlock(&chip->mgr->mixer_mutex); 105 104 return 0; 106 105 } 107 106 ··· 112 111 int changed = 0; 113 112 int is_capture, i; 114 113 115 - down(&chip->mgr->mixer_mutex); 114 + mutex_lock(&chip->mgr->mixer_mutex); 116 115 is_capture = (kcontrol->private_value != 0); 117 116 for (i = 0; i < 2; i++) { 118 117 int new_volume = ucontrol->value.integer.value[i]; ··· 124 123 pcxhr_update_analog_audio_level(chip, is_capture, i); 125 124 } 126 125 } 127 - up(&chip->mgr->mixer_mutex); 126 + mutex_unlock(&chip->mgr->mixer_mutex); 128 127 return changed; 129 128 } 130 129 ··· 151 150 { 152 151 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 153 152 154 - down(&chip->mgr->mixer_mutex); 153 + mutex_lock(&chip->mgr->mixer_mutex); 155 154 ucontrol->value.integer.value[0] = chip->analog_playback_active[0]; 156 155 ucontrol->value.integer.value[1] = chip->analog_playback_active[1]; 157 - up(&chip->mgr->mixer_mutex); 156 + mutex_unlock(&chip->mgr->mixer_mutex); 158 157 return 0; 159 158 } 160 159 ··· 163 162 { 164 163 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 165 164 int i, changed = 0; 166 - down(&chip->mgr->mixer_mutex); 165 + mutex_lock(&chip->mgr->mixer_mutex); 167 166 for(i = 0; i < 2; i++) { 168 167 if (chip->analog_playback_active[i] != ucontrol->value.integer.value[i]) { 169 168 chip->analog_playback_active[i] = ucontrol->value.integer.value[i]; ··· 171 170 pcxhr_update_analog_audio_level(chip, 0, i); /* update playback levels */ 172 171 } 173 172 } 174 - up(&chip->mgr->mixer_mutex); 173 + mutex_unlock(&chip->mgr->mixer_mutex); 175 174 return changed; 176 175 } 177 176 ··· 300 299 int *stored_volume; 301 300 int is_capture = kcontrol->private_value; 302 301 303 - down(&chip->mgr->mixer_mutex); 302 + mutex_lock(&chip->mgr->mixer_mutex); 304 303 if (is_capture) 305 304 stored_volume = chip->digital_capture_volume; /* digital capture */ 306 305 else 307 306 stored_volume = chip->digital_playback_volume[idx]; /* digital playback */ 308 307 ucontrol->value.integer.value[0] = stored_volume[0]; 309 308 ucontrol->value.integer.value[1] = stored_volume[1]; 310 - up(&chip->mgr->mixer_mutex); 309 + mutex_unlock(&chip->mgr->mixer_mutex); 311 310 return 0; 312 311 } 313 312 ··· 321 320 int *stored_volume; 322 321 int i; 323 322 324 - down(&chip->mgr->mixer_mutex); 323 + mutex_lock(&chip->mgr->mixer_mutex); 325 324 if (is_capture) 326 325 stored_volume = chip->digital_capture_volume; /* digital capture */ 327 326 else ··· 336 335 } 337 336 if (! is_capture && changed) 338 337 pcxhr_update_playback_stream_level(chip, idx); /* update playback volume */ 339 - up(&chip->mgr->mixer_mutex); 338 + mutex_unlock(&chip->mgr->mixer_mutex); 340 339 return changed; 341 340 } 342 341 ··· 357 356 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 358 357 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 359 358 360 - down(&chip->mgr->mixer_mutex); 359 + mutex_lock(&chip->mgr->mixer_mutex); 361 360 ucontrol->value.integer.value[0] = chip->digital_playback_active[idx][0]; 362 361 ucontrol->value.integer.value[1] = chip->digital_playback_active[idx][1]; 363 - up(&chip->mgr->mixer_mutex); 362 + mutex_unlock(&chip->mgr->mixer_mutex); 364 363 return 0; 365 364 } 366 365 ··· 371 370 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 372 371 int i, j; 373 372 374 - down(&chip->mgr->mixer_mutex); 373 + mutex_lock(&chip->mgr->mixer_mutex); 375 374 j = idx; 376 375 for (i = 0; i < 2; i++) { 377 376 if (chip->digital_playback_active[j][i] != ucontrol->value.integer.value[i]) { ··· 381 380 } 382 381 if (changed) 383 382 pcxhr_update_playback_stream_level(chip, idx); 384 - up(&chip->mgr->mixer_mutex); 383 + mutex_unlock(&chip->mgr->mixer_mutex); 385 384 return changed; 386 385 } 387 386 ··· 403 402 struct snd_ctl_elem_value *ucontrol) 404 403 { 405 404 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 406 - down(&chip->mgr->mixer_mutex); 405 + mutex_lock(&chip->mgr->mixer_mutex); 407 406 ucontrol->value.integer.value[0] = chip->monitoring_volume[0]; 408 407 ucontrol->value.integer.value[1] = chip->monitoring_volume[1]; 409 - up(&chip->mgr->mixer_mutex); 408 + mutex_unlock(&chip->mgr->mixer_mutex); 410 409 return 0; 411 410 } 412 411 ··· 417 416 int changed = 0; 418 417 int i; 419 418 420 - down(&chip->mgr->mixer_mutex); 419 + mutex_lock(&chip->mgr->mixer_mutex); 421 420 for (i = 0; i < 2; i++) { 422 421 if (chip->monitoring_volume[i] != ucontrol->value.integer.value[i]) { 423 422 chip->monitoring_volume[i] = ucontrol->value.integer.value[i]; ··· 427 426 changed = 1; 428 427 } 429 428 } 430 - up(&chip->mgr->mixer_mutex); 429 + mutex_unlock(&chip->mgr->mixer_mutex); 431 430 return changed; 432 431 } 433 432 ··· 447 446 struct snd_ctl_elem_value *ucontrol) 448 447 { 449 448 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 450 - down(&chip->mgr->mixer_mutex); 449 + mutex_lock(&chip->mgr->mixer_mutex); 451 450 ucontrol->value.integer.value[0] = chip->monitoring_active[0]; 452 451 ucontrol->value.integer.value[1] = chip->monitoring_active[1]; 453 - up(&chip->mgr->mixer_mutex); 452 + mutex_unlock(&chip->mgr->mixer_mutex); 454 453 return 0; 455 454 } 456 455 ··· 461 460 int changed = 0; 462 461 int i; 463 462 464 - down(&chip->mgr->mixer_mutex); 463 + mutex_lock(&chip->mgr->mixer_mutex); 465 464 for (i = 0; i < 2; i++) { 466 465 if (chip->monitoring_active[i] != ucontrol->value.integer.value[i]) { 467 466 chip->monitoring_active[i] = ucontrol->value.integer.value[i]; ··· 475 474 /* update right monitoring volume and mute */ 476 475 pcxhr_update_audio_pipe_level(chip, 0, 1); 477 476 478 - up(&chip->mgr->mixer_mutex); 477 + mutex_unlock(&chip->mgr->mixer_mutex); 479 478 return (changed != 0); 480 479 } 481 480 ··· 572 571 struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol); 573 572 int ret = 0; 574 573 575 - down(&chip->mgr->mixer_mutex); 574 + mutex_lock(&chip->mgr->mixer_mutex); 576 575 if (chip->audio_capture_source != ucontrol->value.enumerated.item[0]) { 577 576 chip->audio_capture_source = ucontrol->value.enumerated.item[0]; 578 577 pcxhr_set_audio_source(chip); 579 578 ret = 1; 580 579 } 581 - up(&chip->mgr->mixer_mutex); 580 + mutex_unlock(&chip->mgr->mixer_mutex); 582 581 return ret; 583 582 } 584 583 ··· 637 636 struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); 638 637 int rate, ret = 0; 639 638 640 - down(&mgr->mixer_mutex); 639 + mutex_lock(&mgr->mixer_mutex); 641 640 if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { 642 - down(&mgr->setup_mutex); 641 + mutex_lock(&mgr->setup_mutex); 643 642 mgr->use_clock_type = ucontrol->value.enumerated.item[0]; 644 643 if (mgr->use_clock_type) 645 644 pcxhr_get_external_clock(mgr, mgr->use_clock_type, &rate); ··· 650 649 if (mgr->sample_rate) 651 650 mgr->sample_rate = rate; 652 651 } 653 - up(&mgr->setup_mutex); 652 + mutex_unlock(&mgr->setup_mutex); 654 653 ret = 1; /* return 1 even if the set was not done. ok ? */ 655 654 } 656 - up(&mgr->mixer_mutex); 655 + mutex_unlock(&mgr->mixer_mutex); 657 656 return ret; 658 657 } 659 658 ··· 686 685 struct pcxhr_mgr *mgr = snd_kcontrol_chip(kcontrol); 687 686 int i, err, rate; 688 687 689 - down(&mgr->mixer_mutex); 688 + mutex_lock(&mgr->mixer_mutex); 690 689 for(i = 0; i < 3 + mgr->capture_chips; i++) { 691 690 if (i == PCXHR_CLOCK_TYPE_INTERNAL) 692 691 rate = mgr->sample_rate_real; ··· 697 696 } 698 697 ucontrol->value.integer.value[i] = rate; 699 698 } 700 - up(&mgr->mixer_mutex); 699 + mutex_unlock(&mgr->mixer_mutex); 701 700 return 0; 702 701 } 703 702 ··· 766 765 unsigned char aes_bits; 767 766 int i, err; 768 767 769 - down(&chip->mgr->mixer_mutex); 768 + mutex_lock(&chip->mgr->mixer_mutex); 770 769 for(i = 0; i < 5; i++) { 771 770 if (kcontrol->private_value == 0) /* playback */ 772 771 aes_bits = chip->aes_bits[i]; ··· 777 776 } 778 777 ucontrol->value.iec958.status[i] = aes_bits; 779 778 } 780 - up(&chip->mgr->mixer_mutex); 779 + mutex_unlock(&chip->mgr->mixer_mutex); 781 780 return 0; 782 781 } 783 782 ··· 829 828 int i, changed = 0; 830 829 831 830 /* playback */ 832 - down(&chip->mgr->mixer_mutex); 831 + mutex_lock(&chip->mgr->mixer_mutex); 833 832 for (i = 0; i < 5; i++) { 834 833 if (ucontrol->value.iec958.status[i] != chip->aes_bits[i]) { 835 834 pcxhr_iec958_update_byte(chip, i, ucontrol->value.iec958.status[i]); 836 835 changed = 1; 837 836 } 838 837 } 839 - up(&chip->mgr->mixer_mutex); 838 + mutex_unlock(&chip->mgr->mixer_mutex); 840 839 return changed; 841 840 } 842 841 ··· 917 916 struct snd_pcxhr *chip; 918 917 int err, i; 919 918 920 - init_MUTEX(&mgr->mixer_mutex); /* can be in another place */ 919 + mutex_init(&mgr->mixer_mutex); /* can be in another place */ 921 920 922 921 for (i = 0; i < mgr->num_cards; i++) { 923 922 struct snd_kcontrol_new temp;
+19 -17
sound/pci/trident/trident_memory.c
··· 27 27 #include <asm/io.h> 28 28 #include <linux/pci.h> 29 29 #include <linux/time.h> 30 + #include <linux/mutex.h> 31 + 30 32 #include <sound/core.h> 31 33 #include <sound/trident.h> 32 34 ··· 203 201 204 202 205 203 206 - down(&hdr->block_mutex); 204 + mutex_lock(&hdr->block_mutex); 207 205 blk = search_empty(hdr, runtime->dma_bytes); 208 206 if (blk == NULL) { 209 - up(&hdr->block_mutex); 207 + mutex_unlock(&hdr->block_mutex); 210 208 return NULL; 211 209 } 212 210 if (lastpg(blk) - firstpg(blk) >= sgbuf->pages) { 213 211 snd_printk(KERN_ERR "page calculation doesn't match: allocated pages = %d, trident = %d/%d\n", sgbuf->pages, firstpg(blk), lastpg(blk)); 214 212 __snd_util_mem_free(hdr, blk); 215 - up(&hdr->block_mutex); 213 + mutex_unlock(&hdr->block_mutex); 216 214 return NULL; 217 215 } 218 216 ··· 223 221 unsigned long ptr = (unsigned long)sgbuf->table[idx].buf; 224 222 if (! is_valid_page(addr)) { 225 223 __snd_util_mem_free(hdr, blk); 226 - up(&hdr->block_mutex); 224 + mutex_unlock(&hdr->block_mutex); 227 225 return NULL; 228 226 } 229 227 set_tlb_bus(trident, page, ptr, addr); 230 228 } 231 - up(&hdr->block_mutex); 229 + mutex_unlock(&hdr->block_mutex); 232 230 return blk; 233 231 } 234 232 ··· 250 248 hdr = trident->tlb.memhdr; 251 249 snd_assert(hdr != NULL, return NULL); 252 250 253 - down(&hdr->block_mutex); 251 + mutex_lock(&hdr->block_mutex); 254 252 blk = search_empty(hdr, runtime->dma_bytes); 255 253 if (blk == NULL) { 256 - up(&hdr->block_mutex); 254 + mutex_unlock(&hdr->block_mutex); 257 255 return NULL; 258 256 } 259 257 ··· 264 262 ptr += SNDRV_TRIDENT_PAGE_SIZE, addr += SNDRV_TRIDENT_PAGE_SIZE) { 265 263 if (! is_valid_page(addr)) { 266 264 __snd_util_mem_free(hdr, blk); 267 - up(&hdr->block_mutex); 265 + mutex_unlock(&hdr->block_mutex); 268 266 return NULL; 269 267 } 270 268 set_tlb_bus(trident, page, ptr, addr); 271 269 } 272 - up(&hdr->block_mutex); 270 + mutex_unlock(&hdr->block_mutex); 273 271 return blk; 274 272 } 275 273 ··· 302 300 snd_assert(blk != NULL, return -EINVAL); 303 301 304 302 hdr = trident->tlb.memhdr; 305 - down(&hdr->block_mutex); 303 + mutex_lock(&hdr->block_mutex); 306 304 /* reset TLB entries */ 307 305 for (page = firstpg(blk); page <= lastpg(blk); page++) 308 306 set_silent_tlb(trident, page); 309 307 /* free memory block */ 310 308 __snd_util_mem_free(hdr, blk); 311 - up(&hdr->block_mutex); 309 + mutex_unlock(&hdr->block_mutex); 312 310 return 0; 313 311 } 314 312 ··· 334 332 struct snd_util_memblk *blk; 335 333 struct snd_util_memhdr *hdr = hw->tlb.memhdr; 336 334 337 - down(&hdr->block_mutex); 335 + mutex_lock(&hdr->block_mutex); 338 336 blk = __snd_util_mem_alloc(hdr, size); 339 337 if (blk == NULL) { 340 - up(&hdr->block_mutex); 338 + mutex_unlock(&hdr->block_mutex); 341 339 return NULL; 342 340 } 343 341 if (synth_alloc_pages(hw, blk)) { 344 342 __snd_util_mem_free(hdr, blk); 345 - up(&hdr->block_mutex); 343 + mutex_unlock(&hdr->block_mutex); 346 344 return NULL; 347 345 } 348 - up(&hdr->block_mutex); 346 + mutex_unlock(&hdr->block_mutex); 349 347 return blk; 350 348 } 351 349 ··· 358 356 { 359 357 struct snd_util_memhdr *hdr = hw->tlb.memhdr; 360 358 361 - down(&hdr->block_mutex); 359 + mutex_lock(&hdr->block_mutex); 362 360 synth_free_pages(hw, blk); 363 361 __snd_util_mem_free(hdr, blk); 364 - up(&hdr->block_mutex); 362 + mutex_unlock(&hdr->block_mutex); 365 363 return 0; 366 364 } 367 365
+10 -8
sound/pci/vx222/vx222_ops.c
··· 24 24 #include <linux/delay.h> 25 25 #include <linux/device.h> 26 26 #include <linux/firmware.h> 27 + #include <linux/mutex.h> 28 + 27 29 #include <sound/core.h> 28 30 #include <sound/control.h> 29 31 #include <asm/io.h> ··· 863 861 { 864 862 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 865 863 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 866 - down(&_chip->mixer_mutex); 864 + mutex_lock(&_chip->mixer_mutex); 867 865 ucontrol->value.integer.value[0] = chip->input_level[0]; 868 866 ucontrol->value.integer.value[1] = chip->input_level[1]; 869 - up(&_chip->mixer_mutex); 867 + mutex_unlock(&_chip->mixer_mutex); 870 868 return 0; 871 869 } 872 870 ··· 874 872 { 875 873 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 876 874 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 877 - down(&_chip->mixer_mutex); 875 + mutex_lock(&_chip->mixer_mutex); 878 876 if (chip->input_level[0] != ucontrol->value.integer.value[0] || 879 877 chip->input_level[1] != ucontrol->value.integer.value[1]) { 880 878 chip->input_level[0] = ucontrol->value.integer.value[0]; 881 879 chip->input_level[1] = ucontrol->value.integer.value[1]; 882 880 vx2_set_input_level(chip); 883 - up(&_chip->mixer_mutex); 881 + mutex_unlock(&_chip->mixer_mutex); 884 882 return 1; 885 883 } 886 - up(&_chip->mixer_mutex); 884 + mutex_unlock(&_chip->mixer_mutex); 887 885 return 0; 888 886 } 889 887 ··· 909 907 { 910 908 struct vx_core *_chip = snd_kcontrol_chip(kcontrol); 911 909 struct snd_vx222 *chip = (struct snd_vx222 *)_chip; 912 - down(&_chip->mixer_mutex); 910 + mutex_lock(&_chip->mixer_mutex); 913 911 if (chip->mic_level != ucontrol->value.integer.value[0]) { 914 912 chip->mic_level = ucontrol->value.integer.value[0]; 915 913 vx2_set_input_level(chip); 916 - up(&_chip->mixer_mutex); 914 + mutex_unlock(&_chip->mixer_mutex); 917 915 return 1; 918 916 } 919 - up(&_chip->mixer_mutex); 917 + mutex_unlock(&_chip->mixer_mutex); 920 918 return 0; 921 919 } 922 920