aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx/cs46xx_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-08 11:12:14 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-13 05:46:38 -0400
commitda3cec35dd3c31d8706db4bf379372ce70d92118 (patch)
tree9379edebb1c7abc7a7a92ce3be30a35b77d9aa1d /sound/pci/cs46xx/cs46xx_lib.c
parent622207dc31895b4e82c39100db8635d885c795e2 (diff)
ALSA: Kill snd_assert() in sound/pci/*
Kill snd_assert() in sound/pci/*, either removed or replaced with if () with snd_BUG_ON(). Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/cs46xx/cs46xx_lib.c')
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index e214e567dec8..a10ab8283f9a 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -90,9 +90,10 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
90 int count; 90 int count;
91 unsigned short result,tmp; 91 unsigned short result,tmp;
92 u32 offset = 0; 92 u32 offset = 0;
93 snd_assert ( (codec_index == CS46XX_PRIMARY_CODEC_INDEX) || 93
94 (codec_index == CS46XX_SECONDARY_CODEC_INDEX), 94 if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
95 return -EINVAL); 95 codec_index != CS46XX_SECONDARY_CODEC_INDEX))
96 return -EINVAL;
96 97
97 chip->active_ctrl(chip, 1); 98 chip->active_ctrl(chip, 1);
98 99
@@ -212,9 +213,9 @@ static unsigned short snd_cs46xx_ac97_read(struct snd_ac97 * ac97,
212 unsigned short val; 213 unsigned short val;
213 int codec_index = ac97->num; 214 int codec_index = ac97->num;
214 215
215 snd_assert(codec_index == CS46XX_PRIMARY_CODEC_INDEX || 216 if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
216 codec_index == CS46XX_SECONDARY_CODEC_INDEX, 217 codec_index != CS46XX_SECONDARY_CODEC_INDEX))
217 return 0xffff); 218 return 0xffff;
218 219
219 val = snd_cs46xx_codec_read(chip, reg, codec_index); 220 val = snd_cs46xx_codec_read(chip, reg, codec_index);
220 221
@@ -229,9 +230,9 @@ static void snd_cs46xx_codec_write(struct snd_cs46xx *chip,
229{ 230{
230 int count; 231 int count;
231 232
232 snd_assert ((codec_index == CS46XX_PRIMARY_CODEC_INDEX) || 233 if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
233 (codec_index == CS46XX_SECONDARY_CODEC_INDEX), 234 codec_index != CS46XX_SECONDARY_CODEC_INDEX))
234 return); 235 return;
235 236
236 chip->active_ctrl(chip, 1); 237 chip->active_ctrl(chip, 1);
237 238
@@ -294,9 +295,9 @@ static void snd_cs46xx_ac97_write(struct snd_ac97 *ac97,
294 struct snd_cs46xx *chip = ac97->private_data; 295 struct snd_cs46xx *chip = ac97->private_data;
295 int codec_index = ac97->num; 296 int codec_index = ac97->num;
296 297
297 snd_assert(codec_index == CS46XX_PRIMARY_CODEC_INDEX || 298 if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
298 codec_index == CS46XX_SECONDARY_CODEC_INDEX, 299 codec_index != CS46XX_SECONDARY_CODEC_INDEX))
299 return); 300 return;
300 301
301 snd_cs46xx_codec_write(chip, reg, val, codec_index); 302 snd_cs46xx_codec_write(chip, reg, val, codec_index);
302} 303}
@@ -315,7 +316,8 @@ int snd_cs46xx_download(struct snd_cs46xx *chip,
315 unsigned int bank = offset >> 16; 316 unsigned int bank = offset >> 16;
316 offset = offset & 0xffff; 317 offset = offset & 0xffff;
317 318
318 snd_assert(!(offset & 3) && !(len & 3), return -EINVAL); 319 if (snd_BUG_ON((offset & 3) || (len & 3)))
320 return -EINVAL;
319 dst = chip->region.idx[bank+1].remap_addr + offset; 321 dst = chip->region.idx[bank+1].remap_addr + offset;
320 len /= sizeof(u32); 322 len /= sizeof(u32);
321 323
@@ -343,7 +345,8 @@ int snd_cs46xx_clear_BA1(struct snd_cs46xx *chip,
343 unsigned int bank = offset >> 16; 345 unsigned int bank = offset >> 16;
344 offset = offset & 0xffff; 346 offset = offset & 0xffff;
345 347
346 snd_assert(!(offset & 3) && !(len & 3), return -EINVAL); 348 if (snd_BUG_ON((offset & 3) || (len & 3)))
349 return -EINVAL;
347 dst = chip->region.idx[bank+1].remap_addr + offset; 350 dst = chip->region.idx[bank+1].remap_addr + offset;
348 len /= sizeof(u32); 351 len /= sizeof(u32);
349 352
@@ -722,7 +725,9 @@ static snd_pcm_uframes_t snd_cs46xx_playback_direct_pointer(struct snd_pcm_subst
722 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 725 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
723 size_t ptr; 726 size_t ptr;
724 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data; 727 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data;
725 snd_assert (cpcm->pcm_channel,return -ENXIO); 728
729 if (snd_BUG_ON(!cpcm->pcm_channel))
730 return -ENXIO;
726 731
727#ifdef CONFIG_SND_CS46XX_NEW_DSP 732#ifdef CONFIG_SND_CS46XX_NEW_DSP
728 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2); 733 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2);
@@ -740,7 +745,8 @@ static snd_pcm_uframes_t snd_cs46xx_playback_indirect_pointer(struct snd_pcm_sub
740 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data; 745 struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data;
741 746
742#ifdef CONFIG_SND_CS46XX_NEW_DSP 747#ifdef CONFIG_SND_CS46XX_NEW_DSP
743 snd_assert (cpcm->pcm_channel,return -ENXIO); 748 if (snd_BUG_ON(!cpcm->pcm_channel))
749 return -ENXIO;
744 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2); 750 ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2);
745#else 751#else
746 ptr = snd_cs46xx_peek(chip, BA1_PBA); 752 ptr = snd_cs46xx_peek(chip, BA1_PBA);
@@ -908,7 +914,8 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
908 cpcm = runtime->private_data; 914 cpcm = runtime->private_data;
909 915
910#ifdef CONFIG_SND_CS46XX_NEW_DSP 916#ifdef CONFIG_SND_CS46XX_NEW_DSP
911 snd_assert (sample_rate != 0, return -ENXIO); 917 if (snd_BUG_ON(!sample_rate))
918 return -ENXIO;
912 919
913 mutex_lock(&chip->spos_mutex); 920 mutex_lock(&chip->spos_mutex);
914 921
@@ -917,7 +924,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
917 return -ENXIO; 924 return -ENXIO;
918 } 925 }
919 926
920 snd_assert (cpcm->pcm_channel != NULL); 927 snd_BUG_ON(!cpcm->pcm_channel);
921 if (!cpcm->pcm_channel) { 928 if (!cpcm->pcm_channel) {
922 mutex_unlock(&chip->spos_mutex); 929 mutex_unlock(&chip->spos_mutex);
923 return -ENXIO; 930 return -ENXIO;
@@ -952,7 +959,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
952 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) { 959 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) {
953 substream->ops = &snd_cs46xx_playback_iec958_ops; 960 substream->ops = &snd_cs46xx_playback_iec958_ops;
954 } else { 961 } else {
955 snd_assert(0); 962 snd_BUG();
956 } 963 }
957#else 964#else
958 substream->ops = &snd_cs46xx_playback_ops; 965 substream->ops = &snd_cs46xx_playback_ops;
@@ -981,7 +988,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
981 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) { 988 } else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) {
982 substream->ops = &snd_cs46xx_playback_indirect_iec958_ops; 989 substream->ops = &snd_cs46xx_playback_indirect_iec958_ops;
983 } else { 990 } else {
984 snd_assert(0); 991 snd_BUG();
985 } 992 }
986#else 993#else
987 substream->ops = &snd_cs46xx_playback_indirect_ops; 994 substream->ops = &snd_cs46xx_playback_indirect_ops;
@@ -1029,7 +1036,8 @@ static int snd_cs46xx_playback_prepare(struct snd_pcm_substream *substream)
1029 cpcm = runtime->private_data; 1036 cpcm = runtime->private_data;
1030 1037
1031#ifdef CONFIG_SND_CS46XX_NEW_DSP 1038#ifdef CONFIG_SND_CS46XX_NEW_DSP
1032 snd_assert (cpcm->pcm_channel != NULL, return -ENXIO); 1039 if (snd_BUG_ON(!cpcm->pcm_channel))
1040 return -ENXIO;
1033 1041
1034 pfie = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 1) << 2 ); 1042 pfie = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 1) << 2 );
1035 pfie &= ~0x0000f03f; 1043 pfie &= ~0x0000f03f;
@@ -1714,9 +1722,9 @@ static void snd_cs46xx_mixer_free_ac97(struct snd_ac97 *ac97)
1714{ 1722{
1715 struct snd_cs46xx *chip = ac97->private_data; 1723 struct snd_cs46xx *chip = ac97->private_data;
1716 1724
1717 snd_assert ((ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) || 1725 if (snd_BUG_ON(ac97 != chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] &&
1718 (ac97 == chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]), 1726 ac97 != chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]))
1719 return); 1727 return;
1720 1728
1721 if (ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) { 1729 if (ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) {
1722 chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] = NULL; 1730 chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] = NULL;
@@ -1864,7 +1872,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
1864 break; 1872 break;
1865 default: 1873 default:
1866 res = -EINVAL; 1874 res = -EINVAL;
1867 snd_assert(0, (void)0); 1875 snd_BUG(); /* should never happen ... */
1868 } 1876 }
1869 1877
1870 return res; 1878 return res;
@@ -2236,7 +2244,7 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2236 snd_printdd("cs46xx: CODOEC2 mode %04x\n",0x3); 2244 snd_printdd("cs46xx: CODOEC2 mode %04x\n",0x3);
2237 snd_cs46xx_ac97_write(ac97,AC97_CSR_ACMODE,0x3); 2245 snd_cs46xx_ac97_write(ac97,AC97_CSR_ACMODE,0x3);
2238 } else { 2246 } else {
2239 snd_assert(0); /* should never happen ... */ 2247 snd_BUG(); /* should never happen ... */
2240 } 2248 }
2241 2249
2242 udelay(50); 2250 udelay(50);
@@ -2553,7 +2561,8 @@ static void snd_cs46xx_gameport_trigger(struct gameport *gameport)
2553{ 2561{
2554 struct snd_cs46xx *chip = gameport_get_port_data(gameport); 2562 struct snd_cs46xx *chip = gameport_get_port_data(gameport);
2555 2563
2556 snd_assert(chip, return); 2564 if (snd_BUG_ON(!chip))
2565 return;
2557 snd_cs46xx_pokeBA0(chip, BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF); 2566 snd_cs46xx_pokeBA0(chip, BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF);
2558} 2567}
2559 2568
@@ -2561,7 +2570,8 @@ static unsigned char snd_cs46xx_gameport_read(struct gameport *gameport)
2561{ 2570{
2562 struct snd_cs46xx *chip = gameport_get_port_data(gameport); 2571 struct snd_cs46xx *chip = gameport_get_port_data(gameport);
2563 2572
2564 snd_assert(chip, return 0); 2573 if (snd_BUG_ON(!chip))
2574 return 0;
2565 return snd_cs46xx_peekBA0(chip, BA0_JSPT); //inb(gameport->io); 2575 return snd_cs46xx_peekBA0(chip, BA0_JSPT); //inb(gameport->io);
2566} 2576}
2567 2577
@@ -2570,7 +2580,8 @@ static int snd_cs46xx_gameport_cooked_read(struct gameport *gameport, int *axes,
2570 struct snd_cs46xx *chip = gameport_get_port_data(gameport); 2580 struct snd_cs46xx *chip = gameport_get_port_data(gameport);
2571 unsigned js1, js2, jst; 2581 unsigned js1, js2, jst;
2572 2582
2573 snd_assert(chip, return 0); 2583 if (snd_BUG_ON(!chip))
2584 return 0;
2574 2585
2575 js1 = snd_cs46xx_peekBA0(chip, BA0_JSC1); 2586 js1 = snd_cs46xx_peekBA0(chip, BA0_JSC1);
2576 js2 = snd_cs46xx_peekBA0(chip, BA0_JSC2); 2587 js2 = snd_cs46xx_peekBA0(chip, BA0_JSC2);
@@ -2754,7 +2765,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip)
2754{ 2765{
2755 int idx; 2766 int idx;
2756 2767
2757 snd_assert(chip != NULL, return -EINVAL); 2768 if (snd_BUG_ON(!chip))
2769 return -EINVAL;
2758 2770
2759 if (chip->active_ctrl) 2771 if (chip->active_ctrl)
2760 chip->active_ctrl(chip, 1); 2772 chip->active_ctrl(chip, 1);