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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'sound-3.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"Here contains only the fixes for the new FireWire bebob driver. All
fairly trivial and local fixes, so safe to apply"

* tag 'sound-3.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: bebob: Correction for return value of special_clk_ctl_put() in error
ALSA: bebob: Correction for return value of .put callback
ALSA: bebob: Use different labels for digital input/output
ALSA: bebob: Fix a missing to unlock mutex in error handling case

+37 -16
+37 -16
sound/firewire/bebob/bebob_maudio.c
··· 379 379 struct special_params *params = bebob->maudio_special_quirk; 380 380 int err, id; 381 381 382 - mutex_lock(&bebob->mutex); 383 - 384 382 id = uval->value.enumerated.item[0]; 385 383 if (id >= ARRAY_SIZE(special_clk_labels)) 386 - return 0; 384 + return -EINVAL; 385 + 386 + mutex_lock(&bebob->mutex); 387 387 388 388 err = avc_maudio_set_special_clk(bebob, id, 389 389 params->dig_in_fmt, ··· 391 391 params->clk_lock); 392 392 mutex_unlock(&bebob->mutex); 393 393 394 - return err >= 0; 394 + if (err >= 0) 395 + err = 1; 396 + 397 + return err; 395 398 } 396 399 static struct snd_kcontrol_new special_clk_ctl = { 397 400 .name = "Clock Source", ··· 437 434 .get = special_sync_ctl_get, 438 435 }; 439 436 440 - /* Digital interface control for special firmware */ 441 - static char *const special_dig_iface_labels[] = { 437 + /* Digital input interface control for special firmware */ 438 + static char *const special_dig_in_iface_labels[] = { 442 439 "S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical" 443 440 }; 444 441 static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, ··· 446 443 { 447 444 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 448 445 einf->count = 1; 449 - einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels); 446 + einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels); 450 447 451 448 if (einf->value.enumerated.item >= einf->value.enumerated.items) 452 449 einf->value.enumerated.item = einf->value.enumerated.items - 1; 453 450 454 451 strcpy(einf->value.enumerated.name, 455 - special_dig_iface_labels[einf->value.enumerated.item]); 452 + special_dig_in_iface_labels[einf->value.enumerated.item]); 456 453 457 454 return 0; 458 455 } ··· 494 491 unsigned int id, dig_in_fmt, dig_in_iface; 495 492 int err; 496 493 497 - mutex_lock(&bebob->mutex); 498 - 499 494 id = uval->value.enumerated.item[0]; 495 + if (id >= ARRAY_SIZE(special_dig_in_iface_labels)) 496 + return -EINVAL; 500 497 501 498 /* decode user value */ 502 499 dig_in_fmt = (id >> 1) & 0x01; 503 500 dig_in_iface = id & 0x01; 501 + 502 + mutex_lock(&bebob->mutex); 504 503 505 504 err = avc_maudio_set_special_clk(bebob, 506 505 params->clk_src, 507 506 dig_in_fmt, 508 507 params->dig_out_fmt, 509 508 params->clk_lock); 510 - if ((err < 0) || (params->dig_in_fmt > 0)) /* ADAT */ 509 + if (err < 0) 511 510 goto end; 512 511 512 + /* For ADAT, optical interface is only available. */ 513 + if (params->dig_in_fmt > 0) { 514 + err = 1; 515 + goto end; 516 + } 517 + 518 + /* For S/PDIF, optical/coaxial interfaces are selectable. */ 513 519 err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); 514 520 if (err < 0) 515 521 dev_err(&bebob->unit->device, 516 522 "fail to set digital input interface: %d\n", err); 523 + err = 1; 517 524 end: 518 525 special_stream_formation_set(bebob); 519 526 mutex_unlock(&bebob->mutex); ··· 538 525 .put = special_dig_in_iface_ctl_set 539 526 }; 540 527 528 + /* Digital output interface control for special firmware */ 529 + static char *const special_dig_out_iface_labels[] = { 530 + "S/PDIF Optical and Coaxial", "ADAT Optical" 531 + }; 541 532 static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl, 542 533 struct snd_ctl_elem_info *einf) 543 534 { 544 535 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 545 536 einf->count = 1; 546 - einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels) - 1; 537 + einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels); 547 538 548 539 if (einf->value.enumerated.item >= einf->value.enumerated.items) 549 540 einf->value.enumerated.item = einf->value.enumerated.items - 1; 550 541 551 542 strcpy(einf->value.enumerated.name, 552 - special_dig_iface_labels[einf->value.enumerated.item + 1]); 543 + special_dig_out_iface_labels[einf->value.enumerated.item]); 553 544 554 545 return 0; 555 546 } ··· 575 558 unsigned int id; 576 559 int err; 577 560 578 - mutex_lock(&bebob->mutex); 579 - 580 561 id = uval->value.enumerated.item[0]; 562 + if (id >= ARRAY_SIZE(special_dig_out_iface_labels)) 563 + return -EINVAL; 564 + 565 + mutex_lock(&bebob->mutex); 581 566 582 567 err = avc_maudio_set_special_clk(bebob, 583 568 params->clk_src, 584 569 params->dig_in_fmt, 585 570 id, params->clk_lock); 586 - if (err >= 0) 571 + if (err >= 0) { 587 572 special_stream_formation_set(bebob); 573 + err = 1; 574 + } 588 575 589 576 mutex_unlock(&bebob->mutex); 590 577 return err;