aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
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/pci
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/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c1
-rw-r--r--sound/pci/ac97/ac97_patch.c3
-rw-r--r--sound/pci/emu10k1/emufx.c34
-rw-r--r--sound/pci/emu10k1/emupcm.c3
-rw-r--r--sound/pci/trident/trident_main.c3
5 files changed, 29 insertions, 15 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 56549add80a8..bbc409ae7ee9 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -1127,7 +1127,6 @@ snd_kcontrol_t *snd_ac97_cnew(const snd_kcontrol_new_t *_template, ac97_t * ac97
1127{ 1127{
1128 snd_kcontrol_new_t template; 1128 snd_kcontrol_new_t template;
1129 memcpy(&template, _template, sizeof(template)); 1129 memcpy(&template, _template, sizeof(template));
1130 snd_runtime_check(!template.index, return NULL);
1131 template.index = ac97->num; 1130 template.index = ac97->num;
1132 return snd_ctl_new1(&template, ac97); 1131 return snd_ctl_new1(&template, ac97);
1133} 1132}
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index b24beb32961e..de1c72ad2c6b 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1460,7 +1460,8 @@ int patch_ad1881(ac97_t * ac97)
1460 codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); 1460 codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14));
1461 codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); 1461 codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13));
1462 1462
1463 snd_runtime_check(codecs[0] | codecs[1] | codecs[2], goto __end); 1463 if (! (codecs[0] || codecs[1] || codecs[2]))
1464 goto __end;
1464 1465
1465 for (idx = 0; idx < 3; idx++) 1466 for (idx = 0; idx < 3; idx++)
1466 if (ac97->spec.ad18xx.unchained[idx]) 1467 if (ac97->spec.ad18xx.unchained[idx])
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 20db3ac6cd61..177c4ad0f778 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -364,12 +364,18 @@ static int snd_emu10k1_gpr_ctl_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
364 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); 364 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]);
365 break; 365 break;
366 case EMU10K1_GPR_TRANSLATION_BASS: 366 case EMU10K1_GPR_TRANSLATION_BASS:
367 snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); 367 if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) {
368 change = -EIO;
369 goto __error;
370 }
368 for (j = 0; j < 5; j++) 371 for (j = 0; j < 5; j++)
369 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); 372 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]);
370 break; 373 break;
371 case EMU10K1_GPR_TRANSLATION_TREBLE: 374 case EMU10K1_GPR_TRANSLATION_TREBLE:
372 snd_runtime_check((ctl->count % 5) == 0 && (ctl->count / 5) == ctl->vcount, change = -EIO; goto __error); 375 if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) {
376 change = -EIO;
377 goto __error;
378 }
373 for (j = 0; j < 5; j++) 379 for (j = 0; j < 5; j++)
374 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); 380 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]);
375 break; 381 break;
@@ -412,8 +418,6 @@ int snd_emu10k1_fx8010_register_irq_handler(emu10k1_t *emu,
412 snd_emu10k1_fx8010_irq_t *irq; 418 snd_emu10k1_fx8010_irq_t *irq;
413 unsigned long flags; 419 unsigned long flags;
414 420
415 snd_runtime_check(emu, return -EINVAL);
416 snd_runtime_check(handler, return -EINVAL);
417 irq = kmalloc(sizeof(*irq), GFP_ATOMIC); 421 irq = kmalloc(sizeof(*irq), GFP_ATOMIC);
418 if (irq == NULL) 422 if (irq == NULL)
419 return -ENOMEM; 423 return -ENOMEM;
@@ -442,7 +446,6 @@ int snd_emu10k1_fx8010_unregister_irq_handler(emu10k1_t *emu,
442 snd_emu10k1_fx8010_irq_t *tmp; 446 snd_emu10k1_fx8010_irq_t *tmp;
443 unsigned long flags; 447 unsigned long flags;
444 448
445 snd_runtime_check(irq, return -EINVAL);
446 spin_lock_irqsave(&emu->fx8010.irq_lock, flags); 449 spin_lock_irqsave(&emu->fx8010.irq_lock, flags);
447 if ((tmp = emu->fx8010.irq_handlers) == irq) { 450 if ((tmp = emu->fx8010.irq_handlers) == irq) {
448 emu->fx8010.irq_handlers = tmp->next; 451 emu->fx8010.irq_handlers = tmp->next;
@@ -717,9 +720,15 @@ static int snd_emu10k1_add_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode
717 err = -EFAULT; 720 err = -EFAULT;
718 goto __error; 721 goto __error;
719 } 722 }
720 snd_runtime_check(gctl->id.iface == SNDRV_CTL_ELEM_IFACE_MIXER || 723 if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
721 gctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM, err = -EINVAL; goto __error); 724 gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
722 snd_runtime_check(gctl->id.name[0] != '\0', err = -EINVAL; goto __error); 725 err = -EINVAL;
726 goto __error;
727 }
728 if (! gctl->id.name[0]) {
729 err = -EINVAL;
730 goto __error;
731 }
723 ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); 732 ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id);
724 memset(&knew, 0, sizeof(knew)); 733 memset(&knew, 0, sizeof(knew));
725 knew.iface = gctl->id.iface; 734 knew.iface = gctl->id.iface;
@@ -783,7 +792,8 @@ static int snd_emu10k1_del_controls(emu10k1_t *emu, emu10k1_fx8010_code_t *icode
783 792
784 for (i = 0, _id = icode->gpr_del_controls; 793 for (i = 0, _id = icode->gpr_del_controls;
785 i < icode->gpr_del_control_count; i++, _id++) { 794 i < icode->gpr_del_control_count; i++, _id++) {
786 snd_runtime_check(copy_from_user(&id, _id, sizeof(id)) == 0, return -EFAULT); 795 if (copy_from_user(&id, _id, sizeof(id)))
796 return -EFAULT;
787 down_write(&card->controls_rwsem); 797 down_write(&card->controls_rwsem);
788 ctl = snd_emu10k1_look_for_ctl(emu, &id); 798 ctl = snd_emu10k1_look_for_ctl(emu, &id);
789 if (ctl) 799 if (ctl)
@@ -2075,14 +2085,16 @@ void snd_emu10k1_free_efx(emu10k1_t *emu)
2075#if 0 // FIXME: who use them? 2085#if 0 // FIXME: who use them?
2076int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output) 2086int snd_emu10k1_fx8010_tone_control_activate(emu10k1_t *emu, int output)
2077{ 2087{
2078 snd_runtime_check(output >= 0 && output < 6, return -EINVAL); 2088 if (output < 0 || output >= 6)
2089 return -EINVAL;
2079 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1); 2090 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1);
2080 return 0; 2091 return 0;
2081} 2092}
2082 2093
2083int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output) 2094int snd_emu10k1_fx8010_tone_control_deactivate(emu10k1_t *emu, int output)
2084{ 2095{
2085 snd_runtime_check(output >= 0 && output < 6, return -EINVAL); 2096 if (output < 0 || output >= 6)
2097 return -EINVAL;
2086 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0); 2098 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0);
2087 return 0; 2099 return 0;
2088} 2100}
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 66ba27afe962..bf7490dae09b 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -965,7 +965,8 @@ static void snd_emu10k1_pcm_mixer_notify1(emu10k1_t *emu, snd_kcontrol_t *kctl,
965{ 965{
966 snd_ctl_elem_id_t id; 966 snd_ctl_elem_id_t id;
967 967
968 snd_runtime_check(kctl != NULL, return); 968 if (! kctl)
969 return;
969 if (activate) 970 if (activate)
970 kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 971 kctl->vd[idx].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
971 else 972 else
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 777da9a7298b..dda62955b4fe 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2893,7 +2893,8 @@ static void snd_trident_notify_pcm_change1(snd_card_t * card, snd_kcontrol_t *kc
2893{ 2893{
2894 snd_ctl_elem_id_t id; 2894 snd_ctl_elem_id_t id;
2895 2895
2896 snd_runtime_check(kctl != NULL, return); 2896 if (! kctl)
2897 return;
2897 if (activate) 2898 if (activate)
2898 kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 2899 kctl->vd[num].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
2899 else 2900 else