aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/oss
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-10-10 05:46:31 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:17:42 -0500
commit7c22f1aaa23370bf9ba2dd3abbccbed70dced216 (patch)
treeebc9c1e5cfdab4815afdfab1ba583e6220287252 /sound/core/oss
parentf01cc521a2abef5dba24fb0873b9626ba6b0a0a5 (diff)
[ALSA] Remove snd_runtime_check() macro
Remove snd_runtime_check() macro. This macro worsens the readability of codes. They should be either normal if() or removable asserts. Also, the assert displays stack-dump, instead of only the last caller pointer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/oss')
-rw-r--r--sound/core/oss/mixer_oss.c59
1 files changed, 41 insertions, 18 deletions
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 69e1059112d1..b2497cec2079 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -521,9 +521,13 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
521 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 521 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
522 if (uinfo == NULL || uctl == NULL) 522 if (uinfo == NULL || uctl == NULL)
523 goto __unalloc; 523 goto __unalloc;
524 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 524 if (kctl->info(kctl, uinfo))
525 snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); 525 goto __unalloc;
526 snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); 526 if (kctl->get(kctl, uctl))
527 goto __unalloc;
528 if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN &&
529 uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1)
530 goto __unalloc;
527 *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]); 531 *left = snd_mixer_oss_conv1(uctl->value.integer.value[0], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[0]);
528 if (uinfo->count > 1) 532 if (uinfo->count > 1)
529 *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]); 533 *right = snd_mixer_oss_conv1(uctl->value.integer.value[1], uinfo->value.integer.min, uinfo->value.integer.max, &pslot->volume[1]);
@@ -555,8 +559,10 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer,
555 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 559 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
556 if (uinfo == NULL || uctl == NULL) 560 if (uinfo == NULL || uctl == NULL)
557 goto __unalloc; 561 goto __unalloc;
558 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 562 if (kctl->info(kctl, uinfo))
559 snd_runtime_check(!kctl->get(kctl, uctl), goto __unalloc); 563 goto __unalloc;
564 if (kctl->get(kctl, uctl))
565 goto __unalloc;
560 if (!uctl->value.integer.value[0]) { 566 if (!uctl->value.integer.value[0]) {
561 *left = 0; 567 *left = 0;
562 if (uinfo->count == 1) 568 if (uinfo->count == 1)
@@ -616,12 +622,16 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer,
616 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 622 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
617 if (uinfo == NULL || uctl == NULL) 623 if (uinfo == NULL || uctl == NULL)
618 goto __unalloc; 624 goto __unalloc;
619 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 625 if (kctl->info(kctl, uinfo))
620 snd_runtime_check(uinfo->type != SNDRV_CTL_ELEM_TYPE_BOOLEAN || uinfo->value.integer.min != 0 || uinfo->value.integer.max != 1, goto __unalloc); 626 goto __unalloc;
627 if (uinfo->type == SNDRV_CTL_ELEM_TYPE_BOOLEAN &&
628 uinfo->value.integer.min == 0 && uinfo->value.integer.max == 1)
629 goto __unalloc;
621 uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max); 630 uctl->value.integer.value[0] = snd_mixer_oss_conv2(left, uinfo->value.integer.min, uinfo->value.integer.max);
622 if (uinfo->count > 1) 631 if (uinfo->count > 1)
623 uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max); 632 uctl->value.integer.value[1] = snd_mixer_oss_conv2(right, uinfo->value.integer.min, uinfo->value.integer.max);
624 snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); 633 if ((res = kctl->put(kctl, uctl)) < 0)
634 goto __unalloc;
625 if (res > 0) 635 if (res > 0)
626 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 636 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
627 __unalloc: 637 __unalloc:
@@ -653,7 +663,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer,
653 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); 663 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
654 if (uinfo == NULL || uctl == NULL) 664 if (uinfo == NULL || uctl == NULL)
655 goto __unalloc; 665 goto __unalloc;
656 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 666 if (kctl->info(kctl, uinfo))
667 goto __unalloc;
657 if (uinfo->count > 1) { 668 if (uinfo->count > 1) {
658 uctl->value.integer.value[0] = left > 0 ? 1 : 0; 669 uctl->value.integer.value[0] = left > 0 ? 1 : 0;
659 uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0; 670 uctl->value.integer.value[route ? 3 : 1] = right > 0 ? 1 : 0;
@@ -664,7 +675,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer,
664 } else { 675 } else {
665 uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0; 676 uctl->value.integer.value[0] = (left > 0 || right > 0) ? 1 : 0;
666 } 677 }
667 snd_runtime_check((res = kctl->put(kctl, uctl)) >= 0, goto __unalloc); 678 if ((res = kctl->put(kctl, uctl)) < 0)
679 goto __unalloc;
668 if (res > 0) 680 if (res > 0)
669 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 681 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
670 __unalloc: 682 __unalloc:
@@ -776,9 +788,14 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
776 } 788 }
777 down_read(&card->controls_rwsem); 789 down_read(&card->controls_rwsem);
778 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); 790 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
779 snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); 791 if (! kctl) {
780 snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); 792 err = -ENOENT;
781 snd_runtime_check(!(err = kctl->get(kctl, uctl)), goto __unlock); 793 goto __unlock;
794 }
795 if ((err = kctl->info(kctl, uinfo)) < 0)
796 goto __unlock;
797 if ((err = kctl->get(kctl, uctl)) < 0)
798 goto __unlock;
782 for (idx = 0; idx < 32; idx++) { 799 for (idx = 0; idx < 32; idx++) {
783 if (!(mixer->mask_recsrc & (1 << idx))) 800 if (!(mixer->mask_recsrc & (1 << idx)))
784 continue; 801 continue;
@@ -821,8 +838,12 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
821 } 838 }
822 down_read(&card->controls_rwsem); 839 down_read(&card->controls_rwsem);
823 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); 840 kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0);
824 snd_runtime_check(kctl != NULL, err = -ENOENT; goto __unlock); 841 if (! kctl) {
825 snd_runtime_check(!(err = kctl->info(kctl, uinfo)), goto __unlock); 842 err = -ENOENT;
843 goto __unlock;
844 }
845 if ((err = kctl->info(kctl, uinfo)) < 0)
846 goto __unlock;
826 for (idx = 0; idx < 32; idx++) { 847 for (idx = 0; idx < 32; idx++) {
827 if (!(mixer->mask_recsrc & (1 << idx))) 848 if (!(mixer->mask_recsrc & (1 << idx)))
828 continue; 849 continue;
@@ -836,10 +857,11 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
836 break; 857 break;
837 slot = NULL; 858 slot = NULL;
838 } 859 }
839 snd_runtime_check(slot != NULL, goto __unlock); 860 if (! slot)
861 goto __unlock;
840 for (idx = 0; idx < uinfo->count; idx++) 862 for (idx = 0; idx < uinfo->count; idx++)
841 uctl->value.enumerated.item[idx] = slot->capture_item; 863 uctl->value.enumerated.item[idx] = slot->capture_item;
842 snd_runtime_check((err = kctl->put(kctl, uctl)) >= 0, ); 864 err = kctl->put(kctl, uctl);
843 if (err > 0) 865 if (err > 0)
844 snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id); 866 snd_ctl_notify(fmixer->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
845 err = 0; 867 err = 0;
@@ -1008,7 +1030,8 @@ static int snd_mixer_oss_build_input(snd_mixer_oss_t *mixer, struct snd_mixer_os
1008 up_read(&mixer->card->controls_rwsem); 1030 up_read(&mixer->card->controls_rwsem);
1009 if (slot.present != 0) { 1031 if (slot.present != 0) {
1010 pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL); 1032 pslot = (struct slot *)kmalloc(sizeof(slot), GFP_KERNEL);
1011 snd_runtime_check(pslot != NULL, return -ENOMEM); 1033 if (! pslot)
1034 return -ENOMEM;
1012 *pslot = slot; 1035 *pslot = slot;
1013 pslot->signature = SNDRV_MIXER_OSS_SIGNATURE; 1036 pslot->signature = SNDRV_MIXER_OSS_SIGNATURE;
1014 pslot->assigned = ptr; 1037 pslot->assigned = ptr;