aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/mixart
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/mixart
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/mixart')
-rw-r--r--sound/pci/mixart/mixart.c4
-rw-r--r--sound/pci/mixart/mixart_core.c18
-rw-r--r--sound/pci/mixart/mixart_hwdep.c19
-rw-r--r--sound/pci/mixart/mixart_mixer.c8
4 files changed, 31 insertions, 18 deletions
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 3dd0c7963273..2d0dce649a64 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -708,7 +708,7 @@ static int snd_mixart_playback_open(struct snd_pcm_substream *subs)
708 pcm_number = MIXART_PCM_ANALOG; 708 pcm_number = MIXART_PCM_ANALOG;
709 runtime->hw = snd_mixart_analog_caps; 709 runtime->hw = snd_mixart_analog_caps;
710 } else { 710 } else {
711 snd_assert ( pcm == chip->pcm_dig ); 711 snd_BUG_ON(pcm != chip->pcm_dig);
712 pcm_number = MIXART_PCM_DIGITAL; 712 pcm_number = MIXART_PCM_DIGITAL;
713 runtime->hw = snd_mixart_digital_caps; 713 runtime->hw = snd_mixart_digital_caps;
714 } 714 }
@@ -783,7 +783,7 @@ static int snd_mixart_capture_open(struct snd_pcm_substream *subs)
783 pcm_number = MIXART_PCM_ANALOG; 783 pcm_number = MIXART_PCM_ANALOG;
784 runtime->hw = snd_mixart_analog_caps; 784 runtime->hw = snd_mixart_analog_caps;
785 } else { 785 } else {
786 snd_assert ( pcm == chip->pcm_dig ); 786 snd_BUG_ON(pcm != chip->pcm_dig);
787 pcm_number = MIXART_PCM_DIGITAL; 787 pcm_number = MIXART_PCM_DIGITAL;
788 runtime->hw = snd_mixart_digital_caps; 788 runtime->hw = snd_mixart_digital_caps;
789 } 789 }
diff --git a/sound/pci/mixart/mixart_core.c b/sound/pci/mixart/mixart_core.c
index 785085e48353..b9a06c279397 100644
--- a/sound/pci/mixart/mixart_core.c
+++ b/sound/pci/mixart/mixart_core.c
@@ -56,8 +56,10 @@ static int retrieve_msg_frame(struct mixart_mgr *mgr, u32 *msg_frame)
56 if (tailptr == headptr) 56 if (tailptr == headptr)
57 return 0; /* no message posted */ 57 return 0; /* no message posted */
58 58
59 snd_assert( tailptr >= MSG_OUTBOUND_POST_STACK, return 0); /* error */ 59 if (tailptr < MSG_OUTBOUND_POST_STACK)
60 snd_assert( tailptr < (MSG_OUTBOUND_POST_STACK+MSG_BOUND_STACK_SIZE), return 0); /* error */ 60 return 0; /* error */
61 if (tailptr >= MSG_OUTBOUND_POST_STACK + MSG_BOUND_STACK_SIZE)
62 return 0; /* error */
61 63
62 *msg_frame = readl_be(MIXART_MEM(mgr, tailptr)); 64 *msg_frame = readl_be(MIXART_MEM(mgr, tailptr));
63 65
@@ -149,7 +151,8 @@ static int send_msg( struct mixart_mgr *mgr,
149 u32 msg_frame_address; 151 u32 msg_frame_address;
150 int err, i; 152 int err, i;
151 153
152 snd_assert(msg->size % 4 == 0, return -EINVAL); 154 if (snd_BUG_ON(msg->size % 4))
155 return -EINVAL;
153 156
154 err = 0; 157 err = 0;
155 158
@@ -289,9 +292,12 @@ int snd_mixart_send_msg_wait_notif(struct mixart_mgr *mgr,
289 wait_queue_t wait; 292 wait_queue_t wait;
290 long timeout; 293 long timeout;
291 294
292 snd_assert(notif_event != 0, return -EINVAL); 295 if (snd_BUG_ON(!notif_event))
293 snd_assert((notif_event & MSG_TYPE_MASK) == MSG_TYPE_NOTIFY, return -EINVAL); 296 return -EINVAL;
294 snd_assert((notif_event & MSG_CANCEL_NOTIFY_MASK) == 0, return -EINVAL); 297 if (snd_BUG_ON((notif_event & MSG_TYPE_MASK) != MSG_TYPE_NOTIFY))
298 return -EINVAL;
299 if (snd_BUG_ON(notif_event & MSG_CANCEL_NOTIFY_MASK))
300 return -EINVAL;
295 301
296 mutex_lock(&mgr->msg_mutex); 302 mutex_lock(&mgr->msg_mutex);
297 303
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index f98603146132..3782b52bc0e8 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -288,7 +288,9 @@ static int mixart_enum_physio(struct mixart_mgr *mgr)
288 return -EINVAL; 288 return -EINVAL;
289 } 289 }
290 290
291 snd_assert(phys_io.nb_uid >= (MIXART_MAX_CARDS * 2), return -EINVAL); /* min 2 phys io per card (analog in + analog out) */ 291 /* min 2 phys io per card (analog in + analog out) */
292 if (phys_io.nb_uid < MIXART_MAX_CARDS * 2)
293 return -EINVAL;
292 294
293 for(k=0; k<mgr->num_cards; k++) { 295 for(k=0; k<mgr->num_cards; k++) {
294 mgr->chip[k]->uid_in_analog_physio = phys_io.uid[k]; 296 mgr->chip[k]->uid_in_analog_physio = phys_io.uid[k];
@@ -363,8 +365,10 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
363 } 365 }
364 366
365 /* check xilinx validity */ 367 /* check xilinx validity */
366 snd_assert(((u32*)(dsp->data))[0]==0xFFFFFFFF, return -EINVAL); 368 if (((u32*)(dsp->data))[0] == 0xffffffff)
367 snd_assert(dsp->size % 4 == 0, return -EINVAL); 369 return -EINVAL;
370 if (dsp->size % 4)
371 return -EINVAL;
368 372
369 /* set xilinx status to copying */ 373 /* set xilinx status to copying */
370 writel_be( 1, MIXART_MEM( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET )); 374 writel_be( 1, MIXART_MEM( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET ));
@@ -462,8 +466,10 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
462 } 466 }
463 467
464 /* check daughterboard xilinx validity */ 468 /* check daughterboard xilinx validity */
465 snd_assert(((u32*)(dsp->data))[0]==0xFFFFFFFF, return -EINVAL); 469 if (((u32*)(dsp->data))[0] == 0xffffffff)
466 snd_assert(dsp->size % 4 == 0, return -EINVAL); 470 return -EINVAL;
471 if (dsp->size % 4)
472 return -EINVAL;
467 473
468 /* inform mixart about the size of the file */ 474 /* inform mixart about the size of the file */
469 writel_be( dsp->size, MIXART_MEM( mgr, MIXART_PSEUDOREG_DXLX_SIZE_OFFSET )); 475 writel_be( dsp->size, MIXART_MEM( mgr, MIXART_PSEUDOREG_DXLX_SIZE_OFFSET ));
@@ -480,7 +486,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
480 486
481 /* get the address where to write the file */ 487 /* get the address where to write the file */
482 val = readl_be( MIXART_MEM( mgr, MIXART_PSEUDOREG_DXLX_BASE_ADDR_OFFSET )); 488 val = readl_be( MIXART_MEM( mgr, MIXART_PSEUDOREG_DXLX_BASE_ADDR_OFFSET ));
483 snd_assert(val != 0, return -EINVAL); 489 if (!val)
490 return -EINVAL;
484 491
485 /* copy daughterboard xilinx code */ 492 /* copy daughterboard xilinx code */
486 memcpy_toio( MIXART_MEM( mgr, val), dsp->data, dsp->size); 493 memcpy_toio( MIXART_MEM( mgr, val), dsp->data, dsp->size);
diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c
index 6fdda1f70b25..3ba6174c3df1 100644
--- a/sound/pci/mixart/mixart_mixer.c
+++ b/sound/pci/mixart/mixart_mixer.c
@@ -837,7 +837,7 @@ static int mixart_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
837 if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */ 837 if(is_aes) stored_volume = chip->digital_capture_volume[1]; /* AES capture */
838 else stored_volume = chip->digital_capture_volume[0]; /* analog capture */ 838 else stored_volume = chip->digital_capture_volume[0]; /* analog capture */
839 } else { 839 } else {
840 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 840 snd_BUG_ON(idx >= MIXART_PLAYBACK_STREAMS);
841 if(is_aes) stored_volume = chip->digital_playback_volume[MIXART_PLAYBACK_STREAMS + idx]; /* AES playback */ 841 if(is_aes) stored_volume = chip->digital_playback_volume[MIXART_PLAYBACK_STREAMS + idx]; /* AES playback */
842 else stored_volume = chip->digital_playback_volume[idx]; /* analog playback */ 842 else stored_volume = chip->digital_playback_volume[idx]; /* analog playback */
843 } 843 }
@@ -863,7 +863,7 @@ static int mixart_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
863 else /* analog capture */ 863 else /* analog capture */
864 stored_volume = chip->digital_capture_volume[0]; 864 stored_volume = chip->digital_capture_volume[0];
865 } else { 865 } else {
866 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 866 snd_BUG_ON(idx >= MIXART_PLAYBACK_STREAMS);
867 if (is_aes) /* AES playback */ 867 if (is_aes) /* AES playback */
868 stored_volume = chip->digital_playback_volume[MIXART_PLAYBACK_STREAMS + idx]; 868 stored_volume = chip->digital_playback_volume[MIXART_PLAYBACK_STREAMS + idx];
869 else /* analog playback */ 869 else /* analog playback */
@@ -909,7 +909,7 @@ static int mixart_pcm_sw_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
909{ 909{
910 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol); 910 struct snd_mixart *chip = snd_kcontrol_chip(kcontrol);
911 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 911 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
912 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 912 snd_BUG_ON(idx >= MIXART_PLAYBACK_STREAMS);
913 mutex_lock(&chip->mgr->mixer_mutex); 913 mutex_lock(&chip->mgr->mixer_mutex);
914 if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */ 914 if(kcontrol->private_value & MIXART_VOL_AES_MASK) /* AES playback */
915 idx += MIXART_PLAYBACK_STREAMS; 915 idx += MIXART_PLAYBACK_STREAMS;
@@ -926,7 +926,7 @@ static int mixart_pcm_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
926 int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK; 926 int is_aes = kcontrol->private_value & MIXART_VOL_AES_MASK;
927 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */ 927 int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); /* index */
928 int i, j; 928 int i, j;
929 snd_assert ( idx < MIXART_PLAYBACK_STREAMS ); 929 snd_BUG_ON(idx >= MIXART_PLAYBACK_STREAMS);
930 mutex_lock(&chip->mgr->mixer_mutex); 930 mutex_lock(&chip->mgr->mixer_mutex);
931 j = idx; 931 j = idx;
932 if (is_aes) 932 if (is_aes)